:root {
    --telkom-red: #E60000;
    --telkom-blue: #00529B;
    --telkom-grey: #f4f7fc;
    --shadow: 0 4px 12px rgba(0,0,0,0.07);
    --border-radius: 16px;
    --status-oa: #20c997;
    --status-done: #28a745;
    --status-matdel: #007bff;
    --status-drop: #b02a37;
    --status-default: #ffc107;
    --gradient-primary: linear-gradient(135deg, var(--telkom-red) 0%, #ff4757 100%);
    --gradient-secondary: linear-gradient(135deg, var(--telkom-blue) 0%, #3742fa 100%);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body { 
    font-family: 'Poppins', sans-serif; 
    background: var(--telkom-grey);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Main container layout */
.container-fluid {
    flex: 1;
}

/* Header Styling */
header { 
    background: #fff; 
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

header h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
}

/* Dropdown styling */
.dropdown-toggle::after {
    vertical-align: middle;
}

.dropdown-menu {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 0.5rem;
}

.dropdown-header {
    padding: 0.75rem 1rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(0,82,155,0.05);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(230,0,0,0.05);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* Analytics Section */
.analytics-section {
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

/* Chart Styling */
.card {
    border: none;
    border-radius: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.card-header {
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.bg-gradient-primary {
    background: var(--gradient-primary) !important;
}

.bg-gradient-secondary {
    background: var(--gradient-secondary) !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
}

/* Chart Center Text */
.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

/* Form Styling */
.form-select, .form-control {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.form-select:focus, .form-control:focus {
    border-color: var(--telkom-red);
    box-shadow: 0 0 0 0.2rem rgba(230, 0, 0, 0.15);
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: var(--telkom-blue);
    border-color: var(--telkom-blue);
    transform: translateY(-2px);
}

.btn-outline-primary {
    border: 2px solid var(--telkom-blue);
    color: var(--telkom-blue);
    border-radius: 12px;
    font-weight: 600;
}

/* Export Buttons Styling */
#export-excel-button,
#export-csv-button {
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.45rem 0.8rem;
}

#export-excel-button {
    background-color: #28a745;
    border-color: #28a745;
}

#export-excel-button:hover:not(:disabled) {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

#export-csv-button {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

#export-csv-button:hover:not(:disabled) {
    background-color: #138496;
    border-color: #117a8b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

#export-excel-button:disabled,
#export-csv-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#export-excel-button i,
#export-csv-button i {
    margin-right: 5px;
}

/* Project Cards */
#project-list .project-card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    background: #fff;
    border-top: 7px solid var(--telkom-red);
    transition: all 0.3s ease;
    text-decoration: none !important;
    color: inherit;
    display: block;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#project-list .project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s ease;
}

#project-list .project-card:hover::before {
    left: 100%;
}

#project-list .project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(230,0,0,0.15);
    border-top-color: var(--telkom-blue);
}

.project-status-badge {
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85em;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--status-default);
    border: none;
    margin-left: 8px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

/* Status Colors */
.status-OA { background: linear-gradient(135deg, var(--status-oa), #17a2b8); }
.status-DONE { background: linear-gradient(135deg, var(--status-done), #20c997); }
.status-MAT-DEL { background: linear-gradient(135deg, var(--status-matdel), #6f42c1); }
.status-DROP { background: linear-gradient(135deg, var(--status-drop), #dc3545); }
.status-POWER-ON, 
.status-MOS, 
.status-INTEGRASI, 
.status-DONE-UT, 
.status-INSTALL-RACK, 
.status-DONE-SURVEY, 
.status-SURVEY { 
    background: linear-gradient(135deg, var(--telkom-blue), #495057); 
}
.status-default { 
    background: linear-gradient(135deg, var(--status-default), #fd7e14); 
}

.project-card h5 { 
    font-weight: 700; 
    color: var(--telkom-blue); 
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.project-card .witel { 
    color: #666; 
    font-size: 1rem; 
    margin-bottom: 1rem;
    font-weight: 500;
}

.project-card .info { 
    color: #888; 
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.project-card .footer { 
    border-top: 1px solid #eee; 
    padding-top: 12px; 
    margin-top: 15px;
}

.project-card .additional-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 3px solid var(--telkom-red);
}

.project-card .additional-info .info-item {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 3px;
}

.project-card .additional-info .info-item strong {
    color: var(--telkom-blue);
}

/* Statistics Total Display */
#total-sites {
    letter-spacing: 0.5px;
    font-weight: 600;
    border-radius: 30px;
    padding: 0.5rem 1rem;
}

/* Loading Animation */
.spinner-border {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animation for filter changes */
#project-list {
    transition: opacity 0.3s ease;
}

.filtering {
    opacity: 0.7;
}

/* Pulse animation for stats */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.stats-update {
    animation: pulse 0.6s ease-in-out;
}

/* No Results */
#no-results img { 
    max-width: 120px; 
    opacity: 0.5; 
    filter: grayscale(1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .analytics-section {
        padding: 1rem;
    }
    
    .main-header h1 { 
        font-size: 1.5rem; 
    }
    
    #project-list .project-card { 
        font-size: 0.95em; 
    }
    
    .form-select, .form-control {
        font-size: 0.9rem;
    }
    
    .project-status-badge {
        font-size: 0.75em;
        padding: 6px 12px;
    }
    
    .card h4 {
        font-size: 1.2rem;
    }
    
    .card h6 {
        font-size: 0.8rem;
    }

    .display-4 {
        font-size: 2rem !important;
    }

    #export-excel-button,
    #export-csv-button {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }
    
    #export-excel-button i::before,
    #export-csv-button i::before {
        margin-right: 3px;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .project-card h5 {
        font-size: 1.1rem;
    }
    
    .additional-info {
        padding: 8px;
    }

    .analytics-section {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }

    header {
        padding-left: -15px !important;
        padding-right: -15px !important;
    }
}

/* Hover Effects */
.form-select:hover, .form-control:hover {
    border-color: var(--telkom-red);
    transform: translateY(-1px);
}

/* Chart responsive sizing */
canvas {
    max-height: 400px !important;
}

/* Error styling */
.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
}

/* Clickable stat cards */
.clickable-stat {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.clickable-stat::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0);
    transition: background-color 0.2s;
}

.clickable-stat:hover::after {
    background-color: rgba(255, 255, 255, 0.1);
}

.clickable-stat.active {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 6px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
}

.clickable-stat.active::before {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    color: var(--telkom-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* STATUS CARDS – 1 ROW */
.status-row-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.status-row {
    display: flex;
    flex-wrap: nowrap;
    gap: .75rem;
}

.status-row .card { 
    min-width: 160px; 
}

/* Footer styling */
footer {
    margin-top: auto;
    color: #666;
}

/* User dropdown styling */
.btn-light {
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-light:hover {
    background-color: rgba(0,82,155,0.1);
}

/* Refresh button */
#refresh-data {
    border-radius: 10px;
    transition: all 0.3s;
}

#refresh-data:hover {
    background-color: var(--telkom-blue);
    color: white;
}

/* Auth check overlay */
.auth-check-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-check-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(230, 0, 0, 0.1);
    border-left-color: #E60000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* Input group styling */
.input-group .form-control {
    border-left: 0;
}

.input-group-text {
    background-color: white;
    border-right: 0;
}

/* Session modal styling */
#sessionTimeoutModal .modal-content {
    border-radius: 15px;
    border: none;
}

#sessionTimeoutModal .modal-header {
    border-bottom: none;
    border-radius: 15px 15px 0 0;
}

#sessionTimeoutModal .modal-footer {
    border-top: none;
}

/* Dropdown menu for user account */
.dropdown-menu {
    min-width: 240px;
    animation: dropdownFadeIn 0.3s ease;
    transform-origin: top right;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Select2 styling */
.select2-container--default .select2-selection--multiple {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--telkom-red);
    box-shadow: 0 0 0 0.2rem rgba(230, 0, 0, 0.15);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--telkom-blue);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 2px 10px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.7);
    margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: white;
}

.select2-dropdown {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.select2-results__option--highlighted {
    background-color: var(--telkom-blue) !important;
}

/* Purple background for POWER ON status */
.bg-purple {
    background: linear-gradient(135deg, #6f42c1, #6610f2);
}

/* Additional status classes */
.status-SURVEY { background: linear-gradient(135deg, #17a2b8, #0dcaf0); }
.status-MOS { background: linear-gradient(135deg, #fd7e14, #ffc107); }
.status-INSTALL-RACK { background: linear-gradient(135deg, #6c757d, #495057); }
.status-POWER-ON { background: linear-gradient(135deg, #6f42c1, #6610f2); }
.status-OA { background: linear-gradient(135deg, #20c997, #198754); }

/* Scrollbar styling for better UX */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--telkom-blue);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--telkom-red);
}

/* Print styles */
@media print {
    header, footer, .btn, .form-select, .form-control {
        display: none;
    }
    
    .card {
        page-break-inside: avoid;
    }
}