/* ===== ROOT VARIABLES (DARK MODE DEFAULT) ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --card-bg: rgba(22, 27, 34, 0.6);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(255, 255, 255, 0.1);
    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: rgba(255, 255, 255, 0.45);
    --text-muted: rgba(255, 255, 255, 0.3);
    --input-bg: rgba(255, 255, 255, 0.03);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-border-focus: rgba(255, 255, 255, 0.25);
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-bg-hover: rgba(255, 255, 255, 0.14);
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --danger: #f85149;
    --success: #3fb950;
    --font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-bg: rgba(13, 17, 23, 0.95);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-footer-border: rgba(255, 255, 255, 0.04);
    --topbar-bg: rgba(13, 17, 23, 0.97);
    --topbar-border: rgba(255, 255, 255, 0.06);
    --table-border: rgba(255, 255, 255, 0.06);
    --table-row-border: rgba(255, 255, 255, 0.03);
    --table-row-hover: rgba(255, 255, 255, 0.02);
    --log-card-bg: rgba(22, 27, 34, 0.5);
    --pagination-border: rgba(255, 255, 255, 0.06);
    --filter-bg: rgba(255, 255, 255, 0.03);
    --filter-border: rgba(255, 255, 255, 0.08);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.3)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ===== LIGHT MODE VARIABLES ===== */
html.light {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(0, 0, 0, 0.08);
    --card-border-hover: rgba(0, 0, 0, 0.15);
    --text-primary: rgba(15, 23, 42, 0.9);
    --text-secondary: rgba(15, 23, 42, 0.55);
    --text-muted: rgba(15, 23, 42, 0.38);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(0, 0, 0, 0.12);
    --input-border-focus: rgba(88, 130, 255, 0.5);
    --btn-bg: rgba(0, 0, 0, 0.05);
    --btn-bg-hover: rgba(0, 0, 0, 0.09);
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --danger: #dc2626;
    --success: #16a34a;
    --sidebar-bg: rgba(255, 255, 255, 0.97);
    --sidebar-border: rgba(0, 0, 0, 0.08);
    --sidebar-footer-border: rgba(0, 0, 0, 0.06);
    --topbar-bg: rgba(255, 255, 255, 0.97);
    --topbar-border: rgba(0, 0, 0, 0.08);
    --table-border: rgba(0, 0, 0, 0.07);
    --table-row-border: rgba(0, 0, 0, 0.04);
    --table-row-hover: rgba(37, 99, 235, 0.03);
    --log-card-bg: rgba(255, 255, 255, 0.8);
    --pagination-border: rgba(0, 0, 0, 0.07);
    --filter-bg: rgba(255, 255, 255, 0.9);
    --filter-border: rgba(0, 0, 0, 0.1);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.35)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Smooth transition saat ganti theme */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
}

/* Center layout for login/register pages */
body:not(:has(.dashboard-layout)) {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    /* Add padding so it doesn't touch top/bottom when scrolling */
}

/* Dashboard pages — no centering */
body:has(.dashboard-layout) {
    display: block;
    overflow: auto;
}

/* ===== ANIMATED BACKGROUND ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(88, 166, 255, 0.04), transparent),
        radial-gradient(ellipse 500px 350px at 80% 70%, rgba(139, 92, 246, 0.03), transparent),
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(255, 255, 255, 0.01), transparent);
    z-index: 0;
    pointer-events: none;
}

.particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: floatParticle 25s linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ===== CONTAINER ===== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== CARD (GLASSMORPHISM) ===== */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 48px 40px 40px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition);
}

.card:hover {
    border-color: var(--card-border-hover);
}

/* Subtle top highlight */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

/* Inner glow */
.card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.01) 0%, transparent 60%);
    pointer-events: none;
}

/* ===== TITLE & SUBTITLE ===== */
.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.card-subtitle {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

/* ===== AVATAR ===== */
.avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 32px;
    position: relative;
    z-index: 1;
    animation: pulseAvatar 4s ease-in-out infinite;
}

.avatar svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

@keyframes pulseAvatar {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }
}

/* ===== FORM ===== */
form {
    position: relative;
    z-index: 1;
}

/* ===== INPUT GROUP ===== */
.input-group {
    position: relative;
    margin-bottom: 18px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color var(--transition);
    z-index: 2;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition);
    outline: none;
    position: relative;
    z-index: 1;
}

.input-group input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.input-group input:focus {
    border-color: var(--input-border-focus);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

.input-group input:focus~.input-glow {
    opacity: 1;
}

.input-group:focus-within .input-icon {
    color: var(--text-secondary);
}

.input-glow {
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.05), transparent, rgba(139, 92, 246, 0.05));
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
    z-index: 0;
}

/* ===== TOGGLE PASSWORD ===== */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    z-index: 2;
    transition: color var(--transition);
    padding: 4px;
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.toggle-password.active {
    color: var(--accent);
}

.password-hint{
    display:block;
    font-size:12px;
    color:#aaa;
    margin-top:-8px;
    margin-bottom:14px;
    margin-left:4px;
}

/* ===== PASSWORD MATCH INDICATOR ===== */
.password-match-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    margin-bottom: 16px;
    padding: 0 4px;
    transition: all var(--transition);
}

.password-match-indicator.match {
    color: var(--success);
}

.password-match-indicator.no-match {
    color: var(--danger);
}

/* ===== BUTTON ===== */
.btn {
    width: 70%;
    margin: 28px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    background: var(--btn-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn:hover {
    background: var(--btn-bg-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Button loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

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

/* ===== SWITCH TEXT (Login/Register link) ===== */
.switch-text {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.switch-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.switch-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition);
}

.switch-link:hover::after {
    width: 100%;
}

.switch-link:hover {
    color: #79b8ff;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(16px);
    max-width: 360px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: rgba(63, 185, 80, 0.9);
    border: 1px solid rgba(63, 185, 80, 0.4);
    box-shadow: 0 8px 32px rgba(63, 185, 80, 0.2);
}

.toast.error {
    background: rgba(248, 81, 73, 0.9);
    border: 1px solid rgba(248, 81, 73, 0.4);
    box-shadow: 0 8px 32px rgba(248, 81, 73, 0.2);
}

.toast.info {
    background: rgba(88, 166, 255, 0.9);
    border: 1px solid rgba(88, 166, 255, 0.4);
    box-shadow: 0 8px 32px rgba(88, 166, 255, 0.2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .card {
        padding: 36px 24px 32px;
    }

    .card-title {
        font-size: 1.15rem;
        letter-spacing: 1.5px;
    }

    .card-subtitle {
        font-size: 0.8rem;
    }

    .avatar {
        width: 80px;
        height: 80px;
        margin-bottom: 24px;
    }

    .btn {
        width: 100%;
        padding: 12px 24px;
    }

    .input-group input {
        font-size: 16px; /* prevent iOS zoom */
        padding: 12px 40px;
    }
}

@media (max-width: 360px) {
    .card {
        padding: 28px 18px 24px;
    }

    .card-title {
        font-size: 1rem;
    }
    
    .input-group input {
        padding: 10px 36px;
    }
}

/* ===== ACCESSIBILITY - Focus Visible ===== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input:focus-visible {
    outline: none;
}

/* ===== SELECTION ===== */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: #fff;
}

/* FIX BROWSER AUTOFILL WHITE BACKGROUND */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px rgba(255,255,255,0.03) inset !important;
    -webkit-text-fill-color: rgba(255,255,255,0.87) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* FORM 2 COLUMN LAYOUT */
.form-layout{
    display:flex;
    gap:40px;
    align-items:stretch;
}

.form-section{
    flex:1;
    min-width:0;
}

.image-section{
    flex:1;
    display:flex;
    justify-content:center;
    align-items:center;
    min-height:100%;
}

.image-section img{
    width:100%;
    height:100%;
    max-width:400px;
    object-fit:contain;
    opacity:0.92;
    border-radius:16px;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.image-section img:hover{
    transform: scale(1.03) translateY(-4px);
    filter: drop-shadow(0 16px 40px rgba(88,166,255,0.2));
}