/* === GLOBAL STYLESHEET === */
/* Styles for elements used on every page */

/* --- General Setup & Reset --- */
:root {
    /* Theme Variables */
    --sidebar-bg: #ffffff;
    --main-bg: #ffc8c8;
    --card-bg: #ffffff;
    --text-primary: #181c32;
    --text-secondary: #7e8299;
    --text-muted: #181c32;
    --border-color: #eef0f8;
    --active-bg: #f5f6f8;
    --white: #ffffff;
    --accent-green: #50cd89;
    --accent-blue: #3699ff;
    --accent-red: #f1416c;
    --accent-orange: #f59e0b;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    display: flex;
    background: linear-gradient(to bottom right, #fddfdf, var(--main-bg)0%);
    background-attachment: fixed;
    font-weight: 800;
}

[data-theme="dark"] {

    --sidebar-bg: #1e1e2d;
    --main-bg: #151521;
    --card-bg: #1e1e2d;
    --text-primary: #ffffff;
    --text-secondary: #a1a5b7;
    --text-muted: #7e8299;
    --border-color: #2d2d41;
    --active-bg: #2b2b3a;
    --white: #1e1e2d;
}

[data-theme="dark"] body {
    background: radial-gradient(ellipse at top, #ff8a8a, var(--main-bg) 100%);
    background-attachment: fixed;
}

/* --- SIDEBAR STYLES --- */
.sidebar {
    width: 90px;
    background-color: #161621;
    border-radius: 24px;
    margin: 16px;
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.4s ease, background-color 0.4s ease;
    overflow: hidden;
}

.sidebar.expanded {
    width: 280px;
    background-color: #161621;
    align-items: flex-start;
}

.sidebar-header {
    display: none;
    align-items: center;
    gap: 15px;
    padding: 10px 15px 30px 35px;
    color: #fff;
    width: 100%;
}

.sidebar.expanded .sidebar-header {
    display: flex;
}

.sidebar-header .brand-name {
    font-size: 22px;
    font-weight: 700;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #f91818;
    margin-bottom: 24px;
    transition: transform 0.2s ease;
}

.sidebar.expanded .sidebar-logo {
    display: none;
}

.sidebar-nav {
    flex-grow: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) transparent;
}

/* WebKit browsers (Chrome, Safari, Edge) */
.sidebar-nav::-webkit-scrollbar {
    width: 3px;
    /* thin scrollbar */
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background-color: var(--scroll-thumb-hover);
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

/* Light mode */
@media (prefers-color-scheme: light) {
    :root {
        --scroll-thumb: rgba(0, 0, 0, 0.3);
        --scroll-thumb-hover: rgba(0, 0, 0, 0.5);
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --scroll-thumb: rgba(255, 255, 255, 0.3);
        --scroll-thumb-hover: rgba(255, 255, 255, 0.5);
    }
}



.sidebar-nav::-webkit-scrollbar-thumb {
    background: #4A4A6A;
    border-radius: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #5a5a7a;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.sidebar.expanded .sidebar-nav ul {
    align-items: stretch;
    gap: 0;
}

.sidebar-nav .nav-item {
    position: relative;
    width: 100%;
}

.nav-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border-radius: 50%;
    background-color: #27273A;
    color: #A1A5B7;
    font-size: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

.nav-item a span {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    position: absolute;
    white-space: nowrap;
}

.sidebar.expanded .nav-item a {
    width: 100%;
    height: auto;
    justify-content: flex-start;
    gap: 20px;
    padding: 20px 25px;
    border-radius: 20px;
    background-color: transparent;
    color: #d4e0ff;
    font-size: 14px;
}

.sidebar.expanded .nav-item a i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar.expanded .nav-item a span {
    opacity: 1;
    visibility: visible;
    position: static;
}

.nav-item:not(.active) a:hover {
    background-color: #3a3a52;
    color: #ffffff;
}

.sidebar.expanded .nav-item:not(.active) a:hover {
    background-color: transparent;
    color: #fff;
}

.nav-item.active a {
    background-color: #F8E750;
    color: #0F1419;
}

.sidebar.expanded .nav-item.active a {
    background-color: #FFEB3Bff;
    color: #1a1a1a;
    left: 20px;
    font-weight: 600;
    border-top-left-radius: 30px;
    border-bottom-left-radius: 30px;
    padding: 20px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sidebar.expanded .nav-item.active::before,
.sidebar.expanded .nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    width: 20px;
    height: 20px;
    background-color: transparent;
}

.sidebar.expanded .nav-item.active::before {
    top: -20px;
    border-bottom-right-radius: 20px;
    box-shadow: 5px 5px 0 5px #FFEB3B;
}

.sidebar.expanded .nav-item.active::after {
    bottom: -20px;
    border-top-right-radius: 20px;
    box-shadow: 5px -5px 0 5px #FFEB3B;
}

.nav-group-title {
    display: none;
}

.sidebar.expanded .nav-group-title {
    display: block;
    padding: 30px 25px 10px 25px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-profile {
    margin-top: 20px;
    background-color: #0052af;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-profile:hover {
    background-color: #3a3a52;
    color: #ffffff;
}

.sidebar.expanded .sidebar-profile {
    display: none;
}

.sidebar-close {
    display: none;
    margin-top: auto;
    width: 100%;
    justify-content: flex-end;
    padding: 10px 15px 0 15px;
}

.sidebar.expanded .sidebar-close {
    display: flex;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    color: #2962ff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.close-btn:hover {
    transform: scale(1.1);
}

/* --- MAIN CONTENT & HEADER STYLES --- */
.main-content {
    margin-left: 122px;
    width: calc(100% - 122px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: margin-left 0.4s ease, width 0.4s ease;
}

.sidebar.expanded+.main-content {
    margin-left: 312px;
    width: calc(100% - 312px);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left .main-title {
    font-size: 35px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.date-time-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-btn {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    transition: all 0.2s ease;
}

.header-icon-btn i,
.header-icon-btn svg {
    text-decoration: none;
    /* in case icon is inside <i> or <svg> */
}

.header-icon-btn:hover {
    background-color: var(--active-bg);
    color: var(--accent-blue);
}

.user-profile-container {
    position: relative;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 6px 15px 6px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-profile-widget.active,
.user-profile-widget:hover {
    background-color: var(--active-bg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-arrow {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.user-profile-widget.active .dropdown-arrow {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 225px;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown ul {
    list-style: none;
}

.profile-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.dropdown-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-dropdown ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.profile-dropdown ul li a:hover {
    background-color: var(--active-bg);
    color: var(--accent-blue);
}

.profile-dropdown ul li a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.logout-link {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
}

.logout-link a:hover {
    color: var(--accent-red) !important;
}

/* A general card style that can be reused on other pages */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.fa-solid,
.fas {
    font-weight: 900;
    font-size: 16px;
}




/* --- Total Sessions Card --- */
.session-chart-wrapper {
    position: relative;
    width: 649px;
    height: 230px;
    /* The "margin: 10px auto;" is removed to prevent forced centering */
    flex-shrink: 0;
    /* Prevents the chart from shrinking */
}

.session-chart-new {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--accent-blue) 0% 71%, var(--accent-green) 71% 99%, var(--accent-orange) 99% 100%);
    position: relative;
}

.session-chart-new::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    height: 75%;
    background: var(--white);
    border-radius: 50%;
    transition: background-color 0.3s;
}

.session-chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.session-total-count {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.session-total-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.session-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* "width: 100%;" is replaced with "flex-grow: 1;" to fill available space */
    flex-grow: 1;
    /* margin-top: 0;  */
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: var(--active-bg);
    border-radius: 8px;
    font-size: 14px;
}

.breakdown-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-app {
    background-color: var(--accent-blue);
}

.dot-rfid {
    background-color: var(--accent-green);
}

.dot-auto {
    background-color: var(--accent-orange);
}

.breakdown-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.breakdown-stats {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.breakdown-value {
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-percentage {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}



