:root {
    --glass-bg: rgba(20, 25, 45, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --neon-blue: rgba(0, 212, 255, 0.6);
    --neon-purple: rgba(138, 43, 226, 0.6);
}

/* --- Penyelarasan Asas & Pengiraan Saiz --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow-x: hidden;
}

.app-container {
    flex: 1 0 auto;
    width: 100%;
}

footer {
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
}

/* --- Latar Belakang Gradient Bergerak Dinamik (Vibrant Deep Palette) --- */
.bg-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(
        -45deg, 
        #070b19, 
        #2a0845, 
        #09203f, 
        #440a4d, 
        #0b3142, 
        #1b0a38
    );
    background-size: 300% 300%;
    animation: gradientFlow 12s ease infinite;
    z-index: -1;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-image {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: url('https://images.unsplash.com/photo-1596422846543-74ecf14b60b7?q=80&w=1920&auto=format&fit=crop') center/cover no-repeat;
    filter: blur(14px) brightness(0.2);
    transform: scale(1.1);
    z-index: -2;
    opacity: 0.35;
}

.z-index-1 { z-index: 1; }
.z-index-top { z-index: 1050; }

/* --- Kad Glassmorphism dengan Sokongan 3D Tilt --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.25s ease;
    color: white;
    transform-style: preserve-3d;
    will-change: transform;
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 
                inset 0 0 20px rgba(138, 43, 226, 0.1),
                0 0 20px var(--neon-purple);
}

/* --- Header Glassbox (Garisan Penuh) --- */
.glass-box-header {
    width: 100%;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.box-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

/* --- Kapsul Counter Bilangan Senarai --- */
.glass-counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1;
    letter-spacing: 0.3px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease;
    user-select: none;
    white-space: nowrap;
}

.glass-counter-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.glass-counter-badge .counter-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-app .counter-dot {
    background: #ff4757;
    box-shadow: 0 0 8px #ff4757;
}

.badge-portal .counter-dot {
    background: #00d2ff;
    box-shadow: 0 0 8px #00d2ff;
}

.badge-doc .counter-dot {
    background: #ffc107;
    box-shadow: 0 0 8px #ffc107;
}

/* --- Bar Carian Global Langsing Kaca --- */
.search-box-wrapper {
    position: relative;
    max-width: 520px;
    width: 100%;
}

.search-input {
    background: rgba(20, 25, 45, 0.65) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50px !important;
    padding: 10px 42px 10px 40px !important;
    color: #ffffff !important;
    font-size: 0.9rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.search-input:focus {
    background: rgba(25, 30, 55, 0.85) !important;
    border-color: #00d2ff !important;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.35) !important;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    padding: 0;
    text-decoration: none;
}

.search-clear:hover {
    color: #ffffff;
}

/* --- Penunjuk Lampu Status Bernadi (Pulse Dots) --- */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.pulse-green {
    background: #2ed573;
    box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
    animation: pulseGreen 1.8s infinite;
}

.pulse-amber {
    background: #ffa502;
    box-shadow: 0 0 0 0 rgba(255, 165, 2, 0.7);
    animation: pulseAmber 1.8s infinite;
}

@keyframes pulseGreen {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(46, 213, 115, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 213, 115, 0); }
}

@keyframes pulseAmber {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 165, 2, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(255, 165, 2, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 165, 2, 0); }
}

/* --- Animasi Kerangka Pemuatan (Skeleton Shimmer) --- */
.skeleton-box {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 10px;
}

.skeleton-text {
    height: 12px;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Notifikasi Toast Kaca (Glass Toast) --- */
.glass-toast {
    background: rgba(20, 25, 45, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

/* --- Butang Pil Interaktif --- */
.pill-clickable {
    cursor: pointer !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.pill-clickable:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: #00d2ff !important;
    color: #00d2ff !important;
}

/* --- Butang Log Masuk Google Bulat Sempurna --- */
.auth-circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(20, 25, 45, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    padding: 0;
    font-size: 1.1rem;
}

.auth-circle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.auth-circle-btn:active {
    transform: scale(0.95);
}

/* --- Kapsul Profil Pengguna Log Masuk --- */
.user-capsule {
    display: inline-flex;
    align-items: center;
    background: rgba(20, 25, 45, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 5px 12px 5px 6px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.user-capsule-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #00d2ff;
}

/* --- Tipografi & Elemen Profil (Hero Section) --- */
.profile-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.5);
}

.shadow-glow {
    box-shadow: 0 0 20px var(--neon-blue);
}

.gradient-text {
    background: linear-gradient(90deg, #00d2ff 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 35px rgba(0, 210, 255, 0.4);
}

.hero-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e2e8f0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

/* --- Ikon Media Sosial --- */
.social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0;
}

.social-icon:hover {
    background: rgba(0, 212, 255, 0.2);
    color: #00d2ff;
    border-color: #00d2ff;
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

/* --- Butang Pil (Pill Badges) --- */
.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    cursor: default;
    white-space: nowrap;
}

.pill-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* --- Bar Tatal Khas (*Custom Scrollbar*) --- */
.custom-scrollbar {
    max-height: 490px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

@media (min-width: 992px) {
    .right-box-scroll {
        max-height: 220px;
    }
}

/* --- Senarai Item Kad (Aplikasi, Portal, Dokumen) --- */
.app-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 8px 12px;
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    transition: background 0.2s ease, transform 0.2s ease;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.app-item-top {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.app-logo,
.portal-favicon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px;
    object-fit: contain;
    margin-right: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.doc-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.app-item:hover .app-logo,
.app-item:hover .portal-favicon,
.app-item:hover .doc-file-icon {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

.app-info-container {
    flex: 1 1 auto;
    min-width: 0;
}

.app-info-container h6 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-info-container small {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.app-action-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.app-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease-in-out;
}

.app-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-app-muted {
    opacity: 0.65;
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.25);
    color: #ffc107;
    cursor: pointer;
}

.btn-app-muted:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

.btn-edit-app,
.btn-delete-app,
.btn-edit-portal,
.btn-delete-portal,
.btn-edit-doc,
.btn-delete-doc,
.btn-copy-link {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn-copy-link {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-copy-link:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d2ff;
    color: #00d2ff;
    transform: scale(1.08);
}

/* --- Pratonton Imej Responsif dalam Modal --- */
.preview-modal-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: block;
    margin: auto;
}

/* --- Penyelarasan Responsif Telefon Pintar --- */
@media (max-width: 576px) {
    .glass-card {
        padding: 1.1rem !important;
        border-radius: 18px;
    }

    .glass-box-header {
        padding-bottom: 10px;
        margin-bottom: 12px;
    }

    .box-title {
        font-size: 1.05rem;
    }

    .pill-badge {
        padding: 6px 12px;
        font-size: 0.75rem;
        gap: 6px;
    }

    .glass-counter-badge {
        font-size: 0.68rem;
        padding: 3px 8px;
    }

    .app-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .app-logo,
    .portal-favicon,
    .doc-file-icon {
        width: 36px;
        height: 36px;
        padding: 5px;
        margin-right: 8px;
        font-size: 1rem;
    }

    .app-info-container h6 {
        font-size: 0.88rem;
    }

    .app-info-container small {
        font-size: 0.75rem;
    }

    .app-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .btn-edit-app,
    .btn-delete-app,
    .btn-edit-portal,
    .btn-delete-portal,
    .btn-edit-doc,
    .btn-delete-doc,
    .btn-copy-link {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    .app-action-group {
        gap: 4px;
    }
}