/**
 * Auth Pages Styles - Sistem JAGAKI
 * Login & Register redesign with modern MDB-style layout
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    --auth-primary: #059669;
    --auth-primary-light: #10b981;
    --auth-primary-dark: #047857;
    --auth-secondary: #0284c7;
    --auth-secondary-dark: #0369a1;
    --auth-accent: #0f766e;
    --auth-surface: #ffffff;
    --auth-bg: #f8fafc;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-danger: #dc2626;
    --auth-success: #16a34a;
    --auth-warning: #d97706;
    --auth-radius: 20px;
    --auth-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
    --auth-shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.08);
    --auth-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Animated gradient background */
.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(15, 118, 110, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(8, 145, 178, 0.04) 0%, transparent 40%);
    animation: authBgDrift 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes authBgDrift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -1%) rotate(1deg); }
    66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

/* Floating decorative blobs */
.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.auth-blob-1 {
    width: 400px;
    height: 400px;
    background: var(--auth-primary);
    top: -100px;
    right: -100px;
    animation: authBlobFloat1 15s ease-in-out infinite;
}

.auth-blob-2 {
    width: 300px;
    height: 300px;
    background: var(--auth-secondary);
    bottom: -80px;
    left: -80px;
    animation: authBlobFloat2 18s ease-in-out infinite;
}

.auth-blob-3 {
    width: 200px;
    height: 200px;
    background: var(--auth-accent);
    top: 50%;
    left: 50%;
    animation: authBlobFloat3 12s ease-in-out infinite;
}

@keyframes authBlobFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 30px) scale(1.05); }
}
@keyframes authBlobFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(25px, -25px) scale(1.08); }
}
@keyframes authBlobFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-55%, -45%) scale(1.1); }
}

/* ============================================================
   CONTAINER & CARD
   ============================================================ */
.auth-container {
    width: 100%;
    max-width: 960px;
    position: relative;
    z-index: 1;
}

.auth-card {
    display: flex;
    background: var(--auth-surface);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    overflow: hidden;
    min-height: 580px;
    /* Entrance animation */
    opacity: 0;
    transform: translateY(30px);
    animation: authCardEnter 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes authCardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   FORM SECTION (LEFT)
   ============================================================ */
.auth-form-section {
    flex: 1;
    padding: 2.5rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* Staggered entrance for form elements */
.auth-form-section > * {
    opacity: 0;
    transform: translateY(15px);
    animation: authStaggerIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.auth-form-section > *:nth-child(1) { animation-delay: 0.15s; }
.auth-form-section > *:nth-child(2) { animation-delay: 0.22s; }
.auth-form-section > *:nth-child(3) { animation-delay: 0.29s; }
.auth-form-section > *:nth-child(4) { animation-delay: 0.36s; }
.auth-form-section > *:nth-child(5) { animation-delay: 0.43s; }
.auth-form-section > *:nth-child(6) { animation-delay: 0.50s; }
.auth-form-section > *:nth-child(7) { animation-delay: 0.57s; }
.auth-form-section > *:nth-child(8) { animation-delay: 0.64s; }
.auth-form-section > *:nth-child(9) { animation-delay: 0.71s; }
.auth-form-section > *:nth-child(10) { animation-delay: 0.78s; }

@keyframes authStaggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.auth-logo img {
    height: 56px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(5, 150, 105, 0.3));
}

.auth-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -0.01em;
}

.auth-partner-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.85rem 0 1rem;
}
.auth-partner-logos img {
    width: auto;
    height: 42px;
    max-width: 46px;
    object-fit: contain;
    padding: 0.2rem;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.92);
}

/* Title & Subtitle */
.auth-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--auth-text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-subtitle {
    font-size: 0.925rem;
    color: var(--auth-muted);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ============================================================
   INPUT GROUPS
   ============================================================ */
.auth-input-wrap {
    margin-bottom: 1.15rem;
    position: relative;
}

.auth-input-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
    transition: color var(--auth-transition);
}

.auth-input-wrap:focus-within .auth-input-label {
    color: var(--auth-primary);
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--auth-text);
    background: #fafbfc;
    outline: none;
    transition: all var(--auth-transition);
    -webkit-appearance: none;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3.5px rgba(15, 118, 110, 0.12);
    background: #ffffff;
}

.auth-input-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    pointer-events: none;
    transition: color var(--auth-transition);
    z-index: 2;
    margin-top: 0.55rem;
}

.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--auth-primary);
}

/* Password with toggle */
.auth-input-wrap.auth-password-wrap {
    position: relative;
}

.auth-input-wrap.auth-password-wrap .auth-input {
    padding-right: 3rem;
}

.auth-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 0.55rem;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--auth-transition);
    z-index: 2;
}

.auth-password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(15, 118, 110, 0.06);
}

.auth-password-toggle i {
    font-size: 1.15rem;
    transition: transform 0.3s ease;
}

.auth-password-toggle:active i {
    transform: scale(0.85);
}

/* Error state */
.auth-input.is-invalid {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 3.5px rgba(220, 38, 38, 0.1);
}

.auth-input.is-invalid:focus {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 3.5px rgba(220, 38, 38, 0.15);
}

.auth-error-msg {
    display: none;
    font-size: 0.8rem;
    color: var(--auth-danger);
    margin-top: 0.35rem;
    padding-left: 0.15rem;
    align-items: center;
    gap: 0.3rem;
}

.auth-error-msg.visible {
    display: flex;
}

/* ============================================================
   PASSWORD STRENGTH INDICATOR
   ============================================================ */
.auth-strength-bar {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
    height: 4px;
}

.auth-strength-segment {
    flex: 1;
    border-radius: 2px;
    background: #e2e8f0;
    transition: background 0.4s ease;
}

.auth-strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
    color: var(--auth-muted);
}

/* Strength levels */
.auth-strength-weak .auth-strength-segment:nth-child(1) { background: var(--auth-danger); }
.auth-strength-weak .auth-strength-text { color: var(--auth-danger); }

.auth-strength-fair .auth-strength-segment:nth-child(1),
.auth-strength-fair .auth-strength-segment:nth-child(2) { background: var(--auth-warning); }
.auth-strength-fair .auth-strength-text { color: var(--auth-warning); }

.auth-strength-good .auth-strength-segment:nth-child(1),
.auth-strength-good .auth-strength-segment:nth-child(2),
.auth-strength-good .auth-strength-segment:nth-child(3) { background: #22c55e; }
.auth-strength-good .auth-strength-text { color: #16a34a; }

.auth-strength-strong .auth-strength-segment { background: var(--auth-success); }
.auth-strength-strong .auth-strength-text { color: var(--auth-success); }

/* ============================================================
   CHECKBOX & FORGOT PASSWORD
   ============================================================ */
.auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--auth-muted);
    user-select: none;
}

.auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
    border-radius: 4px;
}

.auth-forgot {
    font-size: 0.875rem;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--auth-transition);
}

.auth-forgot:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.auth-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.35);
}

.auth-btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.auth-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button shimmer on hover */
.auth-btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s ease;
}

.auth-btn-primary:hover::after {
    left: 100%;
}

/* Spinner */
.auth-spinner {
    display: none;
    width: 1.15rem;
    height: 1.15rem;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

.auth-btn.loading .auth-spinner {
    display: inline-block;
}

.auth-btn.loading .auth-btn-text {
    opacity: 0.7;
}

.auth-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   DIVIDER / LINKS
   ============================================================ */
.auth-link-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--auth-muted);
}

.auth-link-text a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 700;
    transition: color var(--auth-transition);
}

.auth-link-text a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   ALERT / ERROR BOX
   ============================================================ */
.auth-alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: authShake 0.4s ease;
}

.auth-alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert i {
    margin-top: 0.1rem;
    flex-shrink: 0;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(3px); }
}

/* ============================================================
   BRAND SECTION (RIGHT)
   ============================================================ */
.auth-brand-section {
    flex: 0 0 400px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    color: #ffffff;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Decorative overlay pattern */
.auth-brand-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.06) 0%, transparent 50%);
    pointer-events: none;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
}

.auth-brand-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: authFloat 4s ease-in-out infinite;
}

.auth-brand-logo img {
    height: 52px;
    width: auto;
}

.auth-brand-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-brand-tagline {
    font-size: 1.05rem;
    opacity: 0.9;
    margin-bottom: 1rem;
    font-weight: 500;
}

.auth-brand-desc {
    font-size: 0.875rem;
    opacity: 0.75;
    line-height: 1.65;
    max-width: 280px;
    margin: 0 auto;
}

/* Floating decorative elements */
.auth-brand-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-decor-circle {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
}

.auth-decor-circle-1 {
    width: 180px;
    height: 180px;
    top: -40px;
    right: -40px;
    animation: authFloat 6s ease-in-out infinite;
}

.auth-decor-circle-2 {
    width: 120px;
    height: 120px;
    bottom: -30px;
    left: -30px;
    animation: authFloat 5s ease-in-out infinite reverse;
}

.auth-decor-circle-3 {
    width: 80px;
    height: 80px;
    bottom: 25%;
    right: 10%;
    animation: authFloat 7s ease-in-out infinite 1s;
}

.auth-decor-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}

.auth-decor-dot:nth-child(4) { top: 15%; left: 20%; animation: authPulse 3s ease-in-out infinite; }
.auth-decor-dot:nth-child(5) { top: 60%; left: 12%; animation: authPulse 3s ease-in-out infinite 0.5s; }
.auth-decor-dot:nth-child(6) { top: 25%; right: 18%; animation: authPulse 3s ease-in-out infinite 1s; }
.auth-decor-dot:nth-child(7) { bottom: 20%; right: 25%; animation: authPulse 3s ease-in-out infinite 1.5s; }
.auth-decor-dot:nth-child(8) { top: 75%; left: 30%; animation: authPulse 3s ease-in-out infinite 2s; }

@keyframes authFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes authPulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ============================================================
   RESPONSIVE - TABLET
   ============================================================ */
@media (max-width: 991px) {
    .auth-container {
        max-width: 520px;
    }
    
    .auth-card {
        flex-direction: column;
        min-height: auto;
    }
    
    .auth-form-section {
        padding: 2rem 2rem;
    }

    .auth-form-section .auth-logo {
        display: none; /* Logo sudah ada di brand section atas pada mobile */
    }
    
    .auth-brand-section {
        flex: none;
        padding: 2rem 2rem;
        order: -1;
    }
    
    .auth-brand-section::before {
        display: none;
    }
    
    .auth-brand-logo {
        width: 64px;
        height: 64px;
    }
    
    .auth-brand-logo img {
        height: 40px;
    }
    
    .auth-brand-title {
        font-size: 1.25rem;
    }
    
    .auth-brand-desc {
        display: none;
    }
    
    .auth-decor-circle,
    .auth-decor-dot {
        display: none;
    }
}

/* ============================================================
   RESPONSIVE - MOBILE
   ============================================================ */
@media (max-width: 576px) {
    .auth-page {
        padding: 1rem 0.75rem;
    }
    
    .auth-card {
        border-radius: 18px;
    }
    
    .auth-form-section {
        padding: 1.5rem 1.15rem;
    }
    
    .auth-brand-section {
        padding: 1.5rem 1.15rem;
    }
    
    .auth-title {
        font-size: 1.35rem;
    }
    
    .auth-input {
        padding: 0.72rem 0.9rem 0.72rem 2.6rem;
        font-size: 16px !important; /* Mencegah auto-zoom di Android Chrome */
    }
    
    .auth-btn {
        padding: 0.85rem 1.25rem;
        font-size: 1rem;
    }
    
    .auth-form-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .auth-page {
        background: #fff;
        padding: 0;
    }
    .auth-blob, .auth-brand-section {
        display: none !important;
    }
    .auth-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
