/*for PC*/
:root {
    --bg-dark: #796de7ce;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --primary: #002fff;
    --text-main: #1e7afa;
    --text-muted: #6b7280;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: 
    border-box; 
    font-family: 'Inter', sans-serif; }

body {
    background: linear-gradient(135deg, var(--bg-dark), rgb(141, 250, 129));
    height: 100vh;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
}

.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.glass-nav {
    width: 90%;
    max-width: 600px;
    height: 50px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.nav-btn {
    border: none;
    background: transparent;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover { background: rgba(0,0,0,0.05); }
.nav-btn.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(109, 74, 255, 0.3); }
.spacer { flex-grow: 1; }
.icon-only { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-main); }

.main-container {
    display: grid;
    grid-template-columns: 240px 1fr 320px; 
    height: calc(100vh - 80px);
    margin-top: 80px; 
    gap: 20px;
    padding: 20px;
}


.sidebar-left {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-list { list-style: none; }
.menu-list li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}
.menu-list li i { margin-right: 12px; font-size: 1.2rem; }
.menu-list li:hover { background: #f0f2f5; color: var(--primary); }
.menu-list li.active { background: #eeebfc; color: var(--primary); font-weight: 600; }

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #e0e0e0; }
.profile-info small { color: var(--text-muted); display: block; }

.content-area {
    overflow-y: auto;
    padding-right: 10px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding-top: 20px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid transparent;
}

.card:hover { transform: translateY(-5px); border-color: #ddd; }

.card-img {
    width: 64px; height: 64px; margin: 0 auto 15px;
    font-size: 2.5rem; color: var(--primary);
}

.card h4 { font-size: 1rem; margin-bottom: 5px; color: var(--text-main); }
.card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.sidebar-right {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    position: relative;
}

.empty-state {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; color: var(--text-muted);
    opacity: 0.6;
}
.empty-state i { font-size: 3rem; margin-bottom: 10px; }

.item-details { animation: fadeIn 0.3s ease-in-out; }

.detail-icon-wrapper { font-size: 4rem; color: var(--primary); text-align: center; margin-bottom: 15px; }

#d-title { font-size: 1.5rem; margin-bottom: 10px; }
.tag { 
    background: #eeebfc; color: var(--primary); padding: 4px 10px; 
    border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.date-badge { 
    margin: 15px 0; padding: 8px; background: #f8f9fa; border-radius: 8px; 
    font-size: 0.85rem; color: var(--text-muted); text-align: center; display: inline-block; 
}

.description { 
    line-height: 1.6; color: #4b5563; margin-bottom: 25px; 
    min-height: 100px; 
}

.actions { display: flex; gap: 10px; }
.btn-primary, .btn-secondary {
    flex: 1; padding: 10px; border: none; border-radius: 8px;
    font-weight: 500; cursor: pointer; transition: 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-primary:hover { background: #5830e0; }
.btn-secondary:hover { background: #d1d5db; }

@keyframes fadeIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

/*for phone*/

@media screen and (max-width: 1024px) {
    .main-container {
        grid-template-columns: 200px 1fr;
        gap: 15px;
        padding: 15px;
    }

    .sidebar-right {
        display: none;
    }

    .glass-nav {
        width: 95%;
        padding: 0 5px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .card-img {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
}


@media screen and (max-width: 768px) {
    * {
        font-size: 16px; 
    }

    body {
        background: linear-gradient(135deg, var(--bg-dark), rgb(141, 250, 129)) !important;
        overflow-y: auto !important;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .top-bar {
        position: sticky;
        height: 70px;
        background: rgba(255, 255, 255, 0.9);
    }

    .glass-nav {
        width: 95%;
        max-width: 100%;
        height: 55px;
        padding: 0 8px;
        border-radius: 12px;
    }

    .nav-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        min-width: fit-content;
    }

    .spacer {
        display: none;
    }

    .main-container {
        display: block;
        margin-top: 70px;
        padding: 10px;
        height: auto;
        overflow-x: hidden;
    }

    .sidebar-left {
        position: fixed;
        left: -240px;
        top: 70px;
        bottom: 0;
        width: 240px;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        border-radius: 0 16px 16px 0;
        overflow-y: auto;
    }

    .sidebar-left.open {
        left: 0;
    }

    .content-area {
        width: 100% !important;
        padding-right: 0 !important;
        margin-bottom: 20px;
    }

    .sidebar-right {
        display: none;
    }

    .grid-cards {
        grid-template-columns: 1fr;
        gap: 15px;
        padding-top: 10px;
    }

    .card {
        padding: 18px;
        text-align: left;
    }

    .card-img {
        margin-left: 0;
        text-align: left;
    }

    .menu-list li {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 48px; /* Touch-friendly size */
    }

    .user-profile-mini {
        padding: 15px;
        justify-content: center;
    }

    .btn-primary,
    .btn-secondary {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 48px;
    }

    #d-title {
        font-size: 1.3rem;
    }

    .detail-icon-wrapper {
        font-size: 3rem;
    }

    .description {
        line-height: 1.7;
        font-size: 0.95rem;
    }


    .menu-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .menu-overlay.active {
        display: block;
    }
}


@media screen and (max-width: 480px) {
    :root {
        --card-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.08);
    }

    body {
        font-size: 14px;
    }

    .top-bar {
        height: 60px;
    }

    .glass-nav {
        height: 50px;
        border-radius: 10px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .card {
        padding: 16px;
    }

    .card h4 {
        font-size: 0.95rem;
    }

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

    .menu-list li {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .menu-list i {
        font-size: 1.1rem !important;
        margin-right: 10px;
    }

    .actions {
        flex-direction: column;
    }

    .date-badge {
        font-size: 0.8rem;
        padding: 6px;
    }

    .tag {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .avatar {
        width: 32px;
        height: 32px;
    }

    .profile-info small {
        font-size: 0.75rem;
    }
}


@media screen and (max-width: 800px) and (orientation: landscape) {
    body {
        height: 100vh;
        overflow: hidden;
    }

    .main-container {
        height: calc(100vh - 60px);
        margin-top: 60px;
    }

    .sidebar-left {
        width: 180px;
        padding: 15px;
    }

    .sidebar-left::before {
        content: '';
        position: absolute;
        right: -10px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 100px;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 2px;
    }
}


@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(30, 30, 40, 0.85);
        --text-muted: #a0aec0;
    }

    .sidebar-left,
    .sidebar-right,
    .card,
    .nav-btn {
        background: #1a1a2e !important;
        color: #f0f0f0;
    }

    .menu-list li:hover {
        background: #252542 !important;
    }

    .menu-list li.active {
        background: #2d2d44 !important;
    }
}


@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


@media print {
    .top-bar,
    .sidebar-left,
    .sidebar-right {
        display: none;
    }

    .content-area {
        width: 100% !important;
        padding: 0;
        margin: 0;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .nav-btn,
    .menu-list li {
        font-weight: 500;
    }
}


@supports (padding: max(0px)) {
    .top-bar {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .main-container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}
