/* GACS Dashboard Custom Styles */

:root {
    /* Modern Professional Color Palette */
    --primary-color: #4F46E5;        /* Indigo - Modern & Professional */
    --primary-dark: #3730A3;         /* Darker Indigo */
    --primary-light: #6366F1;        /* Lighter Indigo */

    --secondary-color: #64748B;      /* Slate Gray */
    --success-color: #10B981;        /* Emerald Green */
    --danger-color: #EF4444;         /* Red */
    --warning-color: #F59E0B;        /* Amber */
    --info-color: #3B82F6;           /* Blue */

    --dark-color: #1E293B;           /* Dark Slate */
    --darker-color: #0F172A;         /* Darker Slate */
    --light-color: #F8FAFC;          /* Very Light Gray */
    --gray-100: #F1F5F9;             /* Light Gray */
    --gray-200: #E2E8F0;             /* Medium Light Gray */
    --gray-300: #CBD5E1;             /* Medium Gray */

    --sidebar-bg: #1E293B;           /* Dark Professional Sidebar */
    --sidebar-hover: #334155;        /* Sidebar Hover */
    --topbar-bg: #FFFFFF;            /* Clean White Topbar */

    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

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

html {
    height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    zoom: 80%;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    min-height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.sidebar-toggle {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar.collapsed .sidebar-toggle {
    left: 15px;
}

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-header i {
    font-size: 1.8rem !important;
    margin-bottom: 0 !important;
}

.sidebar-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header h3 {
    opacity: 0;
    height: 0;
    font-size: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    background: transparent;
    position: relative;
}

.sidebar.collapsed .sidebar-menu a {
    padding: 1rem 0;
    justify-content: center;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-menu a.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 4px solid var(--primary-color);
    padding-left: calc(1.25rem - 4px);
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu a.active {
    padding-left: 0;
    border-left: none;
    border-bottom: 3px solid var(--primary-color);
}

.sidebar-menu i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar-menu span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu span {
    opacity: 0;
    width: 0;
    display: none;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-menu a {
    position: relative;
}

.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--darker-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--light-color);
    transition: margin-left 0.3s ease;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

.topbar {
    background: var(--topbar-bg);
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.topbar h4 {
    margin: 0;
    color: var(--dark-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-wrapper {
    padding: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background: white;
    color: var(--dark-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    flex: 1 1 0;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    border-color: var(--gray-300);
}

.stat-card.primary {
    border-top: 3px solid var(--primary-color);
}

.stat-card.success {
    border-top: 3px solid var(--success-color);
}

.stat-card.danger {
    border-top: 3px solid var(--danger-color);
}

.stat-card.warning {
    border-top: 3px solid var(--warning-color);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.stat-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    margin: 0.25rem 0 0 0;
    color: var(--secondary-color);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-100);
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--secondary-color);
}

table tbody tr:hover {
    background: var(--gray-100);
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.online {
    background: #D1FAE5;
    color: #065F46;
}

.badge.offline {
    background: #FEE2E2;
    color: #991B1B;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
}

/* Footer */
.footer {
    background: white;
    padding: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
    margin-top: 2rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* Map Styles */
#map {
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
}

/* Alert Styles */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    font-size: 0.9375rem;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #10B981;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #EF4444;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #3B82F6;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline spin animation for icons */
.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Modal Styles */
.modal-content {
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.modal-header .modal-title {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-header .modal-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    border-radius: 0 0 12px 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 100%;
    }
}


/* =========================================================
   PT TRIMAN PREMIUM THEME — branding and visual refinement
   ========================================================= */
:root {
    --primary-color: #5b176f;
    --primary-dark: #351044;
    --primary-light: #7c2b91;
    --secondary-color: #64748b;
    --sidebar-bg: #17152b;
    --sidebar-hover: #302343;
    --topbar-bg: rgba(255,255,255,.94);
    --triman-orange: #f47a20;
    --triman-purple: #5b176f;
    --dark-color: #1f2435;
    --light-color: #f8f7fb;
    --gray-100: #f3f2f7;
    --gray-200: #e8e5ee;
}

body {
    zoom: 1;
    background-color: #f3f2f7;
    background-image:
        linear-gradient(135deg, rgba(248,247,251,.96), rgba(241,238,246,.93)),
        url('/assets/img/triman-factory-3.jpg');
    background-position: center, center;
    background-size: cover, cover;
    background-attachment: fixed, fixed;
}

.sidebar {
    background: linear-gradient(180deg, #19162d 0%, #241532 56%, #351044 100%);
    box-shadow: 8px 0 28px rgba(25, 15, 42, .16);
}

.sidebar-header {
    padding: 1.35rem .9rem 1.25rem;
    background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,0));
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-logo {
    display: block;
    width: 148px;
    max-width: 85%;
    height: 56px;
    object-fit: contain;
    margin: 0 auto .65rem;
    padding: 4px 8px;
    background: rgba(255,255,255,.97);
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(0,0,0,.15);
}

.sidebar-header h3 {
    color: #fff;
    font-weight: 700;
    letter-spacing: .15px;
}

.sidebar.collapsed .sidebar-logo {
    width: 42px;
    height: 42px;
    padding: 3px;
    border-radius: 9px;
    margin-bottom: 0;
}

.sidebar-menu a {
    margin: 4px 10px;
    padding: .85rem .95rem;
    border-radius: 10px;
    color: rgba(255,255,255,.84);
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,.09);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-menu a.active {
    background: linear-gradient(100deg, rgba(244,122,32,.24), rgba(124,43,145,.28));
    color: #fff;
    border-left: 3px solid var(--triman-orange);
    padding-left: calc(.95rem - 3px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.sidebar-menu a.active i {
    color: #ffab63;
}

.sidebar-toggle {
    background: linear-gradient(135deg, var(--triman-purple), #382047);
    border: 1px solid rgba(255,255,255,.24);
    box-shadow: 0 8px 20px rgba(0,0,0,.2);
}

.main-content {
    background: transparent;
}

.topbar {
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid rgba(91,23,111,.09);
    box-shadow: 0 5px 22px rgba(31,20,45,.055);
    backdrop-filter: blur(12px);
}

.topbar h4 {
    color: #292137;
    font-weight: 700;
}

.user-info {
    color: #51445f;
}

.content-wrapper {
    background: rgba(248,247,251,.72);
}

.card, .stat-card, .dashboard-card, .table-container, .login-card {
    border: 1px solid rgba(91,23,111,.09);
    box-shadow: 0 10px 28px rgba(42,24,57,.07);
}

.card, .stat-card, .dashboard-card, .table-container {
    border-radius: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--triman-purple), #79308b);
    border-color: var(--triman-purple);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #42114f, #632476);
    border-color: #42114f;
    box-shadow: 0 7px 18px rgba(91,23,111,.22);
}

.form-control:focus {
    border-color: #8b4a9b;
    box-shadow: 0 0 0 3px rgba(91,23,111,.12);
}

.login-container {
    position: relative;
    background:
        linear-gradient(120deg, rgba(22,18,40,.80), rgba(67,25,77,.58)),
        url('/assets/img/triman-factory-1.jpg') center / cover no-repeat fixed;
}

.login-card {
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.65);
    box-shadow: 0 24px 70px rgba(13,8,25,.3);
    backdrop-filter: blur(14px);
}

.login-header img {
    max-height: 100px;
    object-fit: contain;
}

.login-card .btn-primary,
.login-card button[type="submit"] {
    border-radius: 10px;
}

.footer {
    background: rgba(255,255,255,.84);
    border-top: 1px solid rgba(91,23,111,.08);
}

.footer a {
    color: var(--triman-purple);
}

@media (max-width: 768px) {
    .sidebar-logo {
        width: 130px;
        height: 48px;
    }
    .content-wrapper {
        background: rgba(248,247,251,.86);
    }
}


/* Extended Recent Device Activity monitoring table */
.recent-monitor-table-wrap{max-width:100%;overflow-x:auto;border-radius:10px}
.recent-monitor-table{font-size:12px;min-width:1500px;margin-bottom:0}
.recent-monitor-table thead th{position:sticky;top:0;z-index:2;background:#f8f7fb;color:#33213e;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;border-bottom:1px solid #e7e0ed;padding:12px 10px;white-space:nowrap}
.recent-monitor-table tbody td{padding:10px;vertical-align:middle;border-color:#eee8f3;white-space:nowrap}
.recent-monitor-table tbody tr:hover{background:#fbf8ff}
.recent-monitor-table .metric-cell{min-width:70px}
.recent-monitor-table .metric-track{width:58px;height:4px;background:#ece8f0;border-radius:99px;margin-top:5px;overflow:hidden}
.recent-monitor-table .metric-track span{display:block;height:100%;border-radius:99px}
.recent-monitor-table .metric-bg-success{background:#16a36a}
.recent-monitor-table .metric-bg-warning{background:#d89b15}
.recent-monitor-table .metric-bg-danger{background:#dc3545}
.recent-monitor-table .badge{font-size:10px;font-weight:700}
.recent-monitor-table .text-muted{font-size:10px;display:inline-block;margin-top:4px}
@media(max-width:768px){.recent-monitor-table{min-width:1500px}.recent-monitor-table thead th{padding:10px 8px}}


/* ===== GACS PREMIUM DASHBOARD CHARTS ===== */
#stats-container { gap: 18px; margin-bottom: 24px; }
#stats-container .stat-card {
    min-height: 116px;
    padding: 22px 24px;
    border-radius: 18px;
    background: linear-gradient(145deg,#fff 0%,#faf8fc 100%);
    border: 1px solid rgba(91,23,111,.09);
    box-shadow: 0 8px 24px rgba(40,24,55,.055);
    transition: transform .22s ease, box-shadow .22s ease;
}
#stats-container .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 32px rgba(40,24,55,.11);
}
#stats-container .stat-info h3 {
    font-size: clamp(1.8rem,3vw,2.35rem);
    font-weight: 800;
    letter-spacing: -.04em;
    color: #2c2038;
}
#stats-container .stat-info p {
    color: #82778d;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}
#stats-container .stat-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg,rgba(91,23,111,.12),rgba(244,122,32,.13));
    color: #67277a;
    font-size: 1.35rem;
}
.content-wrapper .card {
    border: 1px solid rgba(91,23,111,.085);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 26px rgba(40,24,55,.055);
}
.content-wrapper .card-header {
    padding: 17px 20px;
    background: linear-gradient(110deg,#fff,#fbf8fd);
    border-bottom: 1px solid #f0eaf3;
    color: #382342;
    font-weight: 750;
}
.content-wrapper .card-body { padding: 22px; }
.content-wrapper #deviceChart,
.content-wrapper #uplinkChart {
    width: 100% !important;
    height: 280px !important;
    max-height: 280px;
}
#dashboard-snmp-live .card-body { background:linear-gradient(145deg,#fff,#fbf9fd); }
#dash-snmp-in, #dash-snmp-out {
    color: #442153;
    font-weight: 800;
    letter-spacing: -.035em;
}
#dash-snmp-chart { border-radius: 12px; background:linear-gradient(180deg,#fbf9fd,#fff); }
.gacs-alarm-card .form-check-input { cursor:pointer; }
.gacs-alarm-card .form-check-input:checked { background-color:#5b176f; border-color:#5b176f; }
@media(max-width:768px) {
    #stats-container .stat-card { min-height:95px; padding:16px; }
    .content-wrapper .card-body { padding:16px; }
    .content-wrapper #deviceChart,
    .content-wrapper #uplinkChart { height:245px !important; }
}
