/* ===== DESIDEX AUTH - UNIFIED DESIGN SYSTEM ===== */

:root {
    --primary-900: #0f766e;
    --primary-700: #0d9488;
    --primary-600: #14b8a6;
    --primary-500: #2dd4bf;
    --primary-400: #5eead4;
    --primary-100: #ccfbf1;
    --primary-50: #f0fdfa;
    
    --gray-900: #111827;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
}

/* ===== PAGE LAYOUT ===== */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    animation: authFadeIn 0.5s ease;
}

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

/* ===== CARD ===== */
.auth-card {
    background: white;
    border-radius: 24px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* ===== HEADER ===== */
.auth-header {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-600) 100%);
    padding: 40px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -30%;
    width: 250px;
    height: 250px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.auth-header::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -10%;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.auth-header-content {
    position: relative;
    z-index: 1;
}

/* Icon */
.auth-icon-box {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 2px solid rgba(255,255,255,0.2);
}

.auth-icon-box svg {
    width: 32px;
    height: 32px;
    color: white;
    stroke: white;
}

.auth-icon-box .emoji {
    font-size: 32px;
    line-height: 1;
}

/* Title */
.auth-header h1 {
    color: white;
    font-size: 1.625rem;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.025em;
}

.auth-header p {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* ===== BODY ===== */
.auth-body {
    padding: 32px;
}

/* ===== ALERTS ===== */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.auth-alert.is-error {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: #991b1b;
}

.auth-alert.is-success {
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.auth-alert.is-warning {
    background: var(--warning-light);
    border: 1px solid #fcd34d;
    color: #92400e;
}

.auth-alert.is-info {
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    color: var(--primary-900);
}

/* ===== FORM ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-label .required {
    color: var(--danger);
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: color 0.2s;
}

.input-wrapper .input-icon svg {
    width: 20px;
    height: 20px;
}

/* Input */
.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input.has-icon {
    padding-left: 48px;
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:hover {
    border-color: var(--gray-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-600);
    background: white;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary-600);
}

.form-input.is-error {
    border-color: var(--danger);
    background: var(--danger-light);
}

.form-input.is-success {
    border-color: var(--success);
}

/* Autofill Override */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--gray-900) !important;
    border-color: var(--primary-600);
}

/* Password Field */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.password-toggle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Field Hint/Error */
.field-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.field-error {
    font-size: 0.8rem;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* ===== ROLE SELECTOR ===== */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.role-option {
    cursor: pointer;
}

.role-option input {
    display: none;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    transition: all 0.25s ease;
}

.role-card:hover {
    border-color: var(--gray-300);
    background: white;
}

.role-option input:checked + .role-card {
    border-color: var(--primary-600);
    background: var(--primary-50);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.15);
}

.role-icon {
    width: 52px;
    height: 52px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.25s ease;
}

.role-icon svg {
    width: 26px;
    height: 26px;
    color: var(--gray-400);
    stroke: var(--gray-400);
    transition: all 0.25s ease;
}

.role-option input:checked + .role-card .role-icon {
    background: var(--primary-600);
    border-color: var(--primary-600);
}

.role-option input:checked + .role-card .role-icon svg {
    color: white;
    stroke: white;
}

.role-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    transition: color 0.25s ease;
}

.role-option input:checked + .role-card .role-title {
    color: var(--primary-900);
}

/* ===== PASSWORD STRENGTH ===== */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-fill.weak { width: 33%; background: var(--danger); }
.strength-fill.medium { width: 66%; background: var(--warning); }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.strength-text.weak { color: var(--danger); }
.strength-text.medium { color: var(--warning); }
.strength-text.strong { color: var(--success); }

/* ===== CHECKBOX ===== */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary-600);
    cursor: pointer;
    flex-shrink: 0;
}

.form-checkbox a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.form-checkbox a:hover {
    text-decoration: underline;
}

/* ===== OPTIONS ROW ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.form-link {
    color: var(--primary-600);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.form-link:hover {
    color: var(--primary-900);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    color: white;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-600) 100%);
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    color: var(--gray-700);
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn-outline {
    color: var(--primary-600);
    background: transparent;
    border: 2px solid var(--primary-600);
}

.btn-outline:hover {
    background: var(--primary-50);
}

/* Button States */
.btn .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn.is-loading .btn-text {
    opacity: 0;
}

.btn.is-loading .spinner {
    position: absolute;
}

/* ===== FOOTER ===== */
.auth-footer {
    text-align: center;
    padding-top: 24px;
    margin-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.auth-footer p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin: 0;
}

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

.auth-footer a:hover {
    color: var(--primary-900);
}

/* ===== BACK LINK ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 24px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-600);
}

.back-link svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

.back-link:hover svg {
    transform: translateX(-3px);
}

/* ===== SUCCESS STATE ===== */
.auth-success {
    text-align: center;
    padding: 20px 0;
}

.success-icon-box {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-light), #d1fae5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon-box svg {
    width: 40px;
    height: 40px;
    color: var(--success);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.auth-success h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 12px;
}

.auth-success p {
    font-size: 0.95rem;
    color: var(--gray-600);
    margin: 0 0 24px;
    line-height: 1.6;
}

/* ===== DIVIDER ===== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.auth-divider span {
    color: var(--gray-400);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== MOBILE ===== */
@media (max-width: 500px) {
    .auth-page {
        padding: 20px 16px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .auth-card {
        border-radius: 20px;
    }
    
    .auth-header {
        padding: 32px 24px;
    }
    
    .auth-header h1 {
        font-size: 1.375rem;
    }
    
    .auth-body {
        padding: 24px;
    }
    
    .form-input {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .role-selector {
        gap: 10px;
    }
    
    .role-card {
        padding: 16px 12px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 360px) {
    .auth-header {
        padding: 28px 20px;
    }
    
    .auth-body {
        padding: 20px;
    }
}

/* ===== LOGO ===== */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
    text-decoration: none;
}

.auth-logo img {
    height: 36px;
    width: auto;
}

.auth-logo span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-900);
    letter-spacing: -0.025em;
}
