/* ================================================================
   USTP PPD TEMERLOH — Premium Design System v2
   ================================================================ */

/* ── Aurora animation ──────────────────────────────────────────── */
@keyframes aurora-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(2%, 1.5%) scale(1.04); }
    66%       { transform: translate(-1.5%, 2%) scale(0.97); }
}
@keyframes scanline {
    0%   { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}
@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}
@keyframes flash-fadeout {
    to { opacity: 0; pointer-events: none; }
}

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --sidebar-w:     260px;
    --topbar-h:      60px;
    --sidebar-bg:    #040f05;
    --sidebar-glow:  rgba(180, 255, 40, 0.12);
    --sidebar-sep:   rgba(180, 255, 40, 0.08);
    --sidebar-hover: rgba(180, 255, 40, 0.06);
    --primary:       #7dba0d;
    --primary-glow:  rgba(160, 230, 20, 0.35);
    --radius-card:   1rem;
    --yg-bright:     #b4f038;
    --yg-mid:        #82c70e;
    --yg-glow:       rgba(180, 240, 40, 0.22);
}

/* ================================================================
   DIGITAL BACKGROUND — Premium Yellow-Green Forest
   ================================================================ */
.digital-bg {
    background-color: #020c01;
    background-image:
        radial-gradient(ellipse 110% 55% at 50% -15%, rgba(180, 255, 30, 0.055) 0%, transparent 65%),
        radial-gradient(ellipse 70%  40% at 90% 105%, rgba(140, 220, 10, 0.04)  0%, transparent 55%),
        radial-gradient(ellipse 60%  35% at 5%   80%, rgba(100, 190, 5,  0.03)  0%, transparent 50%);
    min-height: 100vh;
}

/* Matrix canvas — fixed fullscreen behind everything */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: block;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    background-image:
        radial-gradient(ellipse 140% 45% at 50% 0%,   rgba(180, 255, 40, 0.14) 0%, transparent 60%),
        radial-gradient(ellipse 100% 35% at 0%   100%, rgba(140, 220, 10, 0.09) 0%, transparent 55%);
    border-right: 1px solid var(--sidebar-sep);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Brand area */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.125rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-sep);
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.sidebar-brand:hover { opacity: 0.85; }

.sidebar-logo-badge {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, #4a9c08, #7dba0d);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(125, 186, 13, 0.45);
}
.sidebar-brand-text p:first-child {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.sidebar-brand-text p:last-child {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.38);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Scrollable nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 9999px; }

/* Section label */
.sidebar-label {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.22);
    user-select: none;
}

/* Nav link */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.1rem 0.625rem;
    padding: 0.575rem 0.875rem;
    border-radius: 0.625rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.825rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s ease;
    position: relative;
}
.sidebar-link svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.18s;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255, 255, 255, 0.9);
}
.sidebar-link:hover svg { opacity: 0.9; }

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(90, 160, 8, 0.85), rgba(125, 186, 13, 0.85));
    color: #f0ffd0;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(140, 220, 10, 0.28);
}
.sidebar-link.active svg { opacity: 1; }

/* User section */
.sidebar-user {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-sep);
    background: rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}
.sidebar-user-inner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.5rem;
    border-radius: 0.75rem;
    transition: background 0.15s;
}
.sidebar-user-inner:hover { background: var(--sidebar-hover); }

.sidebar-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #4a9c08, #8fd410);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(125, 186, 13, 0.38);
}
.sidebar-user-name {
    font-size: 0.775rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.38);
    text-transform: capitalize;
    font-weight: 500;
    margin-top: 1px;
}
.sidebar-logout {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: rgba(255,255,255,0.3);
    text-decoration: none;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.15); color: #f87171; }

/* Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 190;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ================================================================
   MAIN WRAPPER & TOPBAR
   ================================================================ */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: rgba(3, 12, 2, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(180, 255, 40, 0.12);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 0.75rem;
}
html.dark .topbar {
    background: rgba(2, 8, 1, 0.90);
    border-bottom-color: rgba(180, 255, 40, 0.09);
}

/* Hamburger */
.hamburger {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: #9ca3af;
    border: 1px solid rgba(255,255,255,0.10);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.hamburger:hover { background: rgba(255,255,255,0.07); color: #f9fafb; }
html.dark .hamburger { color: #9ca3af; border-color: rgba(255,255,255,0.08); }
html.dark .hamburger:hover { background: rgba(255,255,255,0.05); color: #f9fafb; }

/* Page info in topbar */
.topbar-page-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.topbar-page-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html.dark .topbar-page-title { color: #f1f5f9; }

.topbar-controls { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* Language pill */
.lang-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: all 0.15s ease;
    cursor: pointer;
}
.lang-pill.active {
    background: linear-gradient(135deg, #4a9c08, #7dba0d);
    color: #f0ffd0;
    box-shadow: 0 2px 8px rgba(125, 186, 13, 0.40);
}
.lang-pill.inactive { color: #6b7280; }
.lang-pill.inactive:hover { background: #f3f4f6; color: #111827; }
html.dark .lang-pill.inactive { color: #9ca3af; }
html.dark .lang-pill.inactive:hover { background: rgba(255,255,255,0.07); color: #f9fafb; }

/* Dark toggle */
.dark-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.625rem;
    transition: all 0.15s;
    color: #9ca3af;
    border: 1px solid rgba(255,255,255,0.10);
    background: transparent;
    cursor: pointer;
}
.dark-btn:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.18); color: #f9fafb; }
html.dark .dark-btn { color: #9ca3af; border-color: rgba(255,255,255,0.08); }
html.dark .dark-btn:hover { background: rgba(255,255,255,0.06); color: #f9fafb; }

/* Page content area */
.page-content { flex: 1; padding: 1.75rem 1.75rem 1.25rem; }

/* ================================================================
   GUEST LAYOUT (login / register)
   ================================================================ */
.guest-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}
.guest-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--topbar-h);
    background: rgba(248, 250, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    flex-shrink: 0;
}
html.dark .guest-topbar {
    background: rgba(2, 8, 1, 0.90);
    border-bottom-color: rgba(180, 255, 40, 0.09);
}

/* ================================================================
   MOBILE RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .sidebar               { transform: translateX(-100%); }
    .sidebar.open          { transform: translateX(0); box-shadow: 24px 0 60px rgba(0,0,0,0.5); }
    .sidebar-overlay.open  { display: block; }
    .main-wrapper          { margin-left: 0; }
    .hamburger             { display: flex; }
    .page-content          { padding: 1.25rem 1rem 1rem; }
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: #fff;
    border-radius: var(--radius-card);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 6px 20px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s ease;
}
html.dark .card {
    background: rgba(4, 14, 3, 0.84);
    border-color: rgba(180, 255, 40, 0.07);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.25);
}

/* Stat cards */
.stat-card {
    background: rgba(5, 22, 2, 0.76);
    border-radius: var(--radius-card);
    padding: 1.375rem;
    border: 1px solid rgba(180, 240, 30, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-decoration: none;
    box-shadow:
        0 0 28px rgba(180, 240, 30, 0.08),
        0 0 0 1px rgba(180, 240, 30, 0.04) inset,
        0 4px 16px rgba(0,0,0,0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: all 0.22s ease;
    overflow: hidden;
    min-width: 0;
    min-height: 110px;
    height: 100%;
    justify-content: center;
    text-align: center;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(180, 240, 30, 0.42);
    box-shadow:
        0 0 48px rgba(180, 240, 30, 0.16),
        0 0 0 1px rgba(180, 240, 30, 0.08) inset,
        0 10px 32px rgba(0,0,0,0.5);
}
html.dark .stat-card {
    background: rgba(3, 16, 1, 0.82);
    border-color: rgba(180, 240, 30, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 0 28px rgba(180, 240, 30, 0.07),
        0 4px 16px rgba(0,0,0,0.5);
}
html.dark .stat-card:hover {
    box-shadow:
        0 0 48px rgba(180, 240, 30, 0.15),
        0 10px 32px rgba(0,0,0,0.6);
}

/* ================================================================
   GRADIENTS
   ================================================================ */
.banner-gradient    {
    background: linear-gradient(135deg, #071c02 0%, #0e2e04 45%, #0a2203 100%);
    border: 1px solid rgba(180, 240, 30, 0.22);
    box-shadow: 0 0 40px rgba(180, 240, 30, 0.08), 0 4px 24px rgba(0,0,0,0.5);
}
.card-header-gradient { background: linear-gradient(135deg, #071c02 0%, #0e2e04 100%); }

/* ================================================================
   SECTION TITLE
   ================================================================ */
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 1rem;
}
html.dark .section-title { color: #6b7280; }

/* ================================================================
   FORM INPUTS
   ================================================================ */
.form-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border-radius: 0.625rem;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    color: #111827;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-input.error { border-color: #ef4444; }
html.dark .form-input {
    background-color: rgba(4, 14, 2, 0.85);
    border-color: rgba(180, 255, 40, 0.12);
    color: #f0ffd0;
}
html.dark .form-input:focus {
    border-color: #7dba0d;
    box-shadow: 0 0 0 3px rgba(125, 186, 13, 0.22);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #4a9c08, #7dba0d);
    color: #f0ffd0;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    box-shadow: 0 4px 14px rgba(125, 186, 13, 0.38);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #56b50a, #8fd410);
    box-shadow: 0 6px 22px rgba(125, 186, 13, 0.50);
    transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.98); }

/* ================================================================
   FLASH MESSAGE
   ================================================================ */
.flash-message { animation: flash-fadeout 0.4s ease 4s forwards; }

/* ================================================================
   NAV LINK (guest / fallback)
   ================================================================ */
.nav-link {
    display: inline-flex; align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem; font-weight: 500;
    color: #6b7280;
    transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover { background-color: #f3f4f6; color: #111827; }
html.dark .nav-link { color: #9ca3af; }
html.dark .nav-link:hover { background-color: rgba(255,255,255,0.06); color: #f9fafb; }
