: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);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow-x: hidden;
}

/* --- Latar Belakang (KL Skyline Blurred + Gradient) --- */
.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(12px) brightness(0.6);
    transform: scale(1.1);
    z-index: -2;
}

.bg-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(135deg, rgba(8, 11, 26, 0.8) 0%, rgba(32, 14, 58, 0.7) 50%, rgba(13, 30, 56, 0.8) 100%);
    z-index: -1;
}

.z-index-1 { 
    z-index: 1; 
}

/* --- Kad Glassmorphism --- */
.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.3s ease, box-shadow 0.3s ease;
    color: white;
}

.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);
}

/* --- Tipografi & Elemen Profil --- */
.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);
}

.box-title {
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    color: #e0e0e0;
}

/* --- Ikon Media Sosial & Butang Log Masuk --- */
.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);
}

/* Pastikan pengiraan saiz tepat dan tiada limpahan mendatar */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Bentuk Asal Senarai Aplikasi (Glassbox 2) --- */
.app-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s;
    width: 100%;
    margin-bottom: 0; /* Padamkan margin tambahan */
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Memastikan teks boleh truncate tanpa menolak lebar skrin */
.app-item .flex-grow-1 {
    min-width: 0 !important;
}

/* Butang Buka ringkas */
.app-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 5px 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;
}

.app-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* Butang Tindakan Admin */
.btn-edit-app,
.btn-delete-app {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* --- Butang Pil (Pill Badges) --- */
.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05); /* Separa lutsinar mengikut tema gelap */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px; /* Bentuk pil penuh */
    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; /* Kursor biasa kerana ia bukan butang pautan (kecuali jika mahu diklik) */
    white-space: nowrap; /* Elak teks terputus ke baris bawah dalam pil yang sama */
}

.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);
}

/* Penyelarasan untuk skrin telefon pintar */
@media (max-width: 576px) {
    .pill-badge {
        padding: 6px 12px;
        font-size: 0.75rem;
        gap: 6px;
    }
}

/* --- Senarai Aplikasi (Glassbox 2) --- */
.app-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    transition: background 0.3s;
    width: 100%;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-logo {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

/* --- Butang Buka (Gaya Minimalis & Ringkas) --- */
.app-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 6px 13px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    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);
    box-shadow: none; /* Mengeluarkan kilauan neon yang keterlaluan */
}

/* --- Ruang Tambahan & Profil (Glassbox 3) --- */
.placeholder-box {
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

/* --- Penyelarasan Paparan Skrin Telefon Pintar --- */
@media (max-width: 576px) {
    .glass-card {
        padding: 1.25rem !important;
        border-radius: 18px;
    }

    .app-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .app-logo {
        width: 38px;
        height: 38px;
        margin-right: 10px;
    }

    .box-title {
        font-size: 1.1rem;
        padding-bottom: 10px;
    }

    .app-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
}

/* --- Pembaikan Susun Atur Senarai Sistem (Glassbox 2) --- */
.app-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    transition: background 0.3s;
    width: 100%;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-logo {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Membenarkan pemotongan teks secara automatik */
.app-info-container {
    min-width: 0;
    flex: 1;
}

/* Kumpulan Butang Tindakan */
.app-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Susun Atur Responsif untuk Telefon Pintar --- */
@media (max-width: 576px) {
    .glass-card {
        padding: 1.2rem !important;
        border-radius: 18px;
    }

    .app-item {
        padding: 12px;
        /* Ubah layout flex kepada lajur (column) pada skrin kecil */
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    /* Balut logo dan teks menjadi satu baris */
    .app-item-top {
        display: flex;
        width: 100%;
        align-items: center;
    }

    .app-logo {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }

    .app-info-container h6 {
        font-size: 0.95rem;
    }

    .app-info-container small {
        font-size: 0.8rem;
    }

    /* Pindahkan kumpulan butang ke bawah dan ratakan ke kanan/tengah */
    .app-action-group {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }
}