/* ===========================
   GOOGLE FONT
=========================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #edf2f7;
    color: #222;
    display: flex;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
    width: 260px;
    background: #111827;
    min-height: 100vh;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    overflow-x: hidden; /* Prevents horizontal scrollbars */
    overflow-y: auto;   /* Keeps vertical scrolling if links overflow */
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 40;
}

.logo {
    text-align: center;
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.logo img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.sidebar ul {
    list-style: none;
    padding: 25px 0;
}

.sidebar li {
    padding: 16px 30px;
    cursor: pointer;
    transition: .25s;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}

.sidebar li i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar li:hover {
    background: #1f2937;
}

.sidebar .active {
    background: #123E6B;
}

/* ===========================
   SIDEBAR COLLAPSED STATE
=========================== */
.sidebar.collapsed {
    width: 80px;
}

/* Instantly hide anything marked as sidebar-text when collapsed */
.sidebar.collapsed .sidebar-text {
    display: none !important;
}

.sidebar.collapsed .logo {
    padding: 20px 10px;
}

.sidebar.collapsed li {
    padding: 16px;
    justify-content: center;
}

.sidebar.collapsed #collapseBtn {
    justify-content: center;
}

/* ===========================
   MAIN CONTENT CONTAINER
=========================== */
.main {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 35px;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* ===========================
   MAIN CONTENT EXPANSION
=========================== */
.sidebar.collapsed ~ .main {
    margin-left: 80px;
    width: calc(100% - 80px);
}

/* ===========================
   HEADER
=========================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.title h1 {
    font-size: 28px;
    font-family: 'Poppins', sans-serif;
}

.title p {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar input {
    padding: 12px 18px;
    width: 280px;
    border: none;
    outline: none;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
}

.topbar button {
    width: 46px;
    height: 46px;
    border: none;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
    font-size: 16px;
    color: #4b5563;
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 6px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
}

.profile img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

/* ===========================
   SECTION TITLES
=========================== */
section {
    margin-bottom: 40px;
}

section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    font-family: 'Poppins', sans-serif;
}

/* ===========================
   APPLICATIONS CARDS
=========================== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 22px;
    width: 100%;
}

.app-card {
    background: white;
    border-radius: 18px;
    padding: 25px;
    text-align: center;
    transition: .3s;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .07);
}

.app-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, .12);
}

.app-card i {
    font-size: 38px;
    color: #123E6B;
    margin-bottom: 12px;
}

.app-card h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

/* ===========================
   LOCATIONS GRID
=========================== */
.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.location-card {
    background: white;
    padding: 25px;
    border-radius: 18px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .08);
    transition: .3s;
    flex: 0 0 240px;
}

.location-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, .12);
}

.location-card h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.location-card p {
    margin: 8px 0;
    color: #555;
    font-size: 13px;
}

.online {
    color: #16a34a;
    font-weight: 700;
}

.warning {
    color: #eab308;
    font-weight: 700;
}

/* ===========================
   TABLE STYLING
=========================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .08);
}

thead {
    background: #123E6B;
    color: white;
}

th {
    padding: 16px 18px;
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px 18px;
    border-bottom: 1px solid #ececec;
    font-size: 14px;
}

tbody tr:hover {
    background: #f4f8ff;
}

/* ===========================
   STATS CARDS
=========================== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 18px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .08);
    transition: .3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, .12);
}

.stat-card h3 {
    font-size: 15px;
    color: #4b5563;
}

.stat-card h1 {
    font-size: 38px;
    margin: 10px 0;
    color: #123E6B;
}

/* ===========================
   ALERTS SECTION
=========================== */
.alert {
    padding: 16px 22px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.critical {
    background: #fee2e2;
    color: #991b1b;
    border-left: 6px solid #dc2626;
}

.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 6px solid #d97706;
}

.info {
    background: #dbeafe;
    color: #1d4ed8;
    border-left: 6px solid #123E6B;
}

/* ===========================
   SCROLLBAR & TRANSITIONS
=========================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: #123E6B;
    border-radius: 20px;
}


/* ===========================
    DARK MODE STYLES
=========================== */
body.dark-mode {background: #030712; color: #f3f4f6;}
body.dark-mode p {color: #9ca3af;}
body.dark-mode h3 {color: white;}

body.dark-mode .main header .topbar input,
body.dark-mode .main header .topbar button,
body.dark-mode .profile,
body.dark-mode .app-card,
body.dark-mode .location-card,
body.dark-mode .stat-card,
body.dark-mode table,
body.dark-mode .notification-container {
    background: #111827;
    color: #f3f4f6;
    border-color: #1f2937;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .4);
}

body.dark-mode .notification-container {
    background: #111827 !important;
    color: #f3f4f6 !important;
    border: 1px solid #1f2937;
}

body.dark-mode .notification-container h3,
body.dark-mode .notification-container h4 {
    color: #f3f4f6 !important;
}

body.dark-mode .notification-container p {
    color: #9ca3af !important;
}

body.dark-mode .notification-container .alert-item {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #f3f4f6 !important;
}
body.dark-mode td {
    border-bottom: 1px solid #1f2937;
}

body.dark-mode tbody tr:hover {
    background: #1f2937;
}

body.dark-mode .topbar input {
    color: #f3f4f6;
}

body.dark-mode .topbar input::placeholder {
    color: #9ca3af;
}

.app-auth-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #1e3a8a; /* Dark blue */
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    text-align: center;
}

/* ===========================
    LOG IN/OUT BUTTON
=========================== */
.app-text-link {
    color: #1e3a8a; /* Dark blue */
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.app-text-link:hover {
    color: #1d4ed8; /* Lighter blue on hover */
    text-decoration: underline;
}

/* ===========================
   USERS SUB-TABS TOGGLE STYLES
=========================== */
.users-subtab-content {
    display: none;
}

.users-subtab-content.active-subtab {
    display: block;
}