/* =============================================
   LANTING DIGITAL - UX FOCUSED SPLIT THEME
   Contract Signing Page
   ============================================= */

:root {
    --bg-app: #f3f4f6;          /* Light cool grey */
    --bg-panel: #ffffff;
    --text-primary: #111827;    /* Almost black */
    --text-secondary: #4b5563;  /* Cool grey */
    --text-muted: #9ca3af;

    --accent-gold: #b45309;     /* Refined Gold */
    --accent-gold-light: #fffbeb;
    --accent-dark: #1e1e1e;     /* Luxury Dark */

    --success: #059669;
    --success-bg: #dcfce7;
    --danger: #dc2626;

    --border: #e5e7eb;
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =============================================
   SCREENS
   ============================================= */
.screen {
    display: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 20;
}

.brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    background: var(--accent-gold-light);
    color: var(--accent-gold);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.secure-badge {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.secure-badge i {
    color: var(--success);
}

/* =============================================
   SPLIT LAYOUT
   ============================================= */
.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    position: relative;
}

/* LEFT PANEL: DOCUMENT VIEWER */
.doc-viewer {
    flex: 1;
    background: #d1d5db;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.paper-document {
    background: #fff;
    width: 100%;
    max-width: 800px;
    padding: 60px;
    box-shadow: var(--shadow-float);
    color: #333;
    font-family: 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.6;
    margin: 0 auto 40px auto;
    /* Allow document to grow to fit content */
    height: auto;
    min-height: fit-content;
    /* Prevent content overflow */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Ensure contract content stays within bounds */
.paper-document * {
    max-width: 100%;
    box-sizing: border-box;
}

.paper-document img {
    max-width: 100%;
    height: auto;
}

.paper-document table {
    width: 100%;
    table-layout: fixed;
}

/* RIGHT PANEL: ACTION CENTER */
.action-panel {
    width: 400px;
    background: #fff;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.03);
}

.action-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.action-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.action-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.action-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.action-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-app);
}

/* =============================================
   FORM ELEMENTS (SIDEBAR)
   ============================================= */
.form-step {
    margin-bottom: 32px;
}

.step-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fff;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px var(--accent-gold-light);
}

/* Typed Signature Input */
.signature-input-wrapper {
    position: relative;
}

.signature-input {
    font-family: 'Dancing Script', cursive !important;
    font-size: 1.5rem !important;
    padding-right: 40px !important;
    cursor: pointer;
    background: #fafafa;
}

.signature-input:focus {
    background: #fff;
}

.signature-input::placeholder {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-muted);
}

.signature-lock-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-gold);
    font-size: 1.1rem;
}

.signature-hint {
    font-size: 0.8rem;
    color: var(--accent-gold);
    margin-top: 6px;
    cursor: pointer;
}

.signature-hint:hover {
    text-decoration: underline;
}

.signature-acknowledged {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hidden {
    display: none !important;
}

/* Checkbox / Terms */
.terms-check {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--accent-gold-light);
    border: 1px solid rgba(180, 83, 9, 0.2);
    border-radius: 8px;
    cursor: pointer;
}

.terms-check input {
    margin-top: 4px;
    accent-color: var(--accent-gold);
    width: 18px;
    height: 18px;
}

.terms-check span {
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-weight: 500;
    line-height: 1.4;
}

/* Portfolio Permission */
.portfolio-section {
    margin-bottom: 24px;
}

.portfolio-section label.step-label {
    margin-bottom: 12px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.radio-option:hover {
    border-color: var(--accent-gold);
}

.radio-option input[type="radio"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-gold);
}

.radio-option span {
    flex: 1;
    line-height: 1.4;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Button */
.btn-sign {
    width: 100%;
    padding: 16px;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
}

.btn-sign:hover {
    background: #000;
    transform: translateY(-1px);
}

.btn-sign:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   DOCUMENT STYLING
   ============================================= */
h1.doc-title {
    text-align: center;
    font-size: 24pt;
    font-family: 'Playfair Display', serif;
    margin-bottom: 10px;
    color: #1a1a1a;
}

p.doc-subtitle {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.doc-section {
    margin-bottom: 24px;
}

.doc-section h3 {
    font-size: 12pt;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #1a1a1a;
}

.doc-section p {
    margin-bottom: 12px;
    text-align: justify;
}

table.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 10pt;
}

table.doc-table th {
    border-bottom: 2px solid #000;
    text-align: left;
    padding: 8px;
    font-weight: 700;
}

table.doc-table td {
    border-bottom: 1px solid #eee;
    padding: 8px;
}

/* Signature Preview Area in Document */
.signature-area-preview {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #eee;
    display: flex;
    justify-content: space-between;
}

.sig-block {
    width: 45%;
}

.sig-block p {
    margin: 4px 0;
    text-align: left;
}

.sig-line {
    border-bottom: 1px solid #000;
    height: 40px;
    margin: 10px 0;
    display: flex;
    align-items: flex-end;
    font-family: 'Dancing Script', cursive;
    font-size: 20pt;
    color: var(--accent-gold);
    padding-bottom: 2px;
}

.sig-line.client-sig {
    color: #111;
}

/* Placeholder text inside doc */
.placeholder-text {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9em;
}

/* =============================================
   LOADING/ERROR/SUCCESS SCREENS
   ============================================= */
.loading-container,
.error-container,
.signed-container,
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px;
    background: #fff;
}

.loading-container i,
.error-container i,
.signed-container i,
.success-container i {
    font-size: 4rem;
    margin-bottom: 20px;
}

.loading-container i { color: var(--accent-gold); }
.error-container i { color: var(--danger); }
.signed-container i,
.success-container i { color: var(--success); }

.success-icon-circle {
    width: 80px;
    height: 80px;
    background: var(--success-bg);
    border-radius: 50%;
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 24px;
}

.loading-container h1,
.error-container h1,
.signed-container h1,
.success-container h1 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 16px;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.loading-container p,
.error-container p,
.signed-container p,
.success-container p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.success-details {
    background: var(--bg-app);
    padding: 20px 30px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--border);
}

.btn-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
}

.btn-link:hover {
    color: var(--accent-gold);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #000;
    transform: translateY(-1px);
}

/* =============================================
   SIGNATURE MODAL
   ============================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-float);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--accent-gold);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.signature-preview-input {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}

.signature-preview-box {
    margin: 20px 0;
    padding: 20px;
    background: #fafafa;
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
}

.preview-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.signature-preview {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: var(--text-primary);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-preview.empty {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-style: italic;
}

.modal-terms {
    margin-top: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-app);
    border-radius: 0 0 12px 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-secondary:hover {
    background: var(--bg-app);
    border-color: var(--text-muted);
}

.modal .btn-primary {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.modal .btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-float);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-color: var(--danger);
}

.toast.error i {
    color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =============================================
   RESPONSIVE (MOBILE)
   ============================================= */
@media (max-width: 900px) {
    body {
        overflow: auto;
        display: block;
        height: auto;
    }

    .screen.active {
        display: block;
        height: auto;
    }

    .main-container {
        display: block;
        height: auto;
    }

    .doc-viewer {
        height: auto;
        max-height: 500px;
        padding: 20px;
    }

    .action-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .paper-document {
        padding: 30px;
        min-height: auto;
    }

    .signature-area-preview {
        flex-direction: column;
    }

    .sig-block {
        width: 100%;
        margin-bottom: 30px;
    }

    .navbar {
        padding: 0 16px;
    }

    .brand-badge {
        display: none;
    }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    body {
        background: white;
        overflow: visible;
        height: auto;
    }

    .navbar,
    .action-panel {
        display: none !important;
    }

    .doc-viewer {
        padding: 0;
        background: white;
    }

    .paper-document {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
}

/* =============================================
   LOGIN SCREEN
   ============================================= */
#login-screen {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.login-container {
    background: #fff;
    padding: 48px;
    border-radius: 16px;
    box-shadow: var(--shadow-float);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-header {
    margin-bottom: 32px;
}

.login-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.btn-google {
    width: 100%;
    padding: 14px 24px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: var(--text-secondary);
}

.btn-google:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-google i {
    font-size: 1.2rem;
    color: #4285f4;
}

.login-note {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-note i {
    color: var(--success);
}
