.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 18, 16, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: var(--bg);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 32px 32px 0;
    text-align: center;
}

.modal-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 12px;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 24px 32px 0;
}

.modal-step {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s ease;
}

.modal-step.active {
    background: var(--primary);
}

.modal-step.completed {
    background: var(--accent);
}

.modal-body {
    padding: 32px;
}

.modal-step-content {
    display: none;
}

.modal-step-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-light);
}

.phone-input-group {
    display: flex;
    gap: 12px;
}

.phone-prefix {
    width: 80px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.phone-input-group .form-input {
    flex: 1;
}

.otp-input-group {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color 0.2s ease;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-modal {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-modal:hover {
    background: var(--primary-dark);
}

.btn-modal:active {
    transform: scale(0.98);
}

.btn-modal:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-modal.loading {
    position: relative;
    color: transparent;
}

.btn-modal.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.role-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.role-option {
    padding: 20px;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: left;
}

.role-option:hover {
    border-color: var(--primary);
    background: var(--white);
}

.role-option-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.role-option-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-footer {
    padding: 0 32px 32px;
    text-align: center;
}

.modal-footer-text {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-footer-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.modal-footer-link:hover {
    text-decoration: underline;
}

.resend-otp {
    text-align: center;
    margin-top: 16px;
}

.resend-otp button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.resend-otp button:disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

.resend-otp span {
    color: var(--text-muted);
    font-size: 14px;
}

.error-message {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.error-message.show {
    display: block;
}

@media (max-width: 480px) {
    .modal-container {
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .modal-header, .modal-body, .modal-footer {
        padding-left: 24px;
        padding-right: 24px;
    }

    .otp-input {
        width: 40px;
        height: 48px;
        font-size: 20px;
    }
}
