/* ============================================================
   SPARING GJM — ENHANCED UI/UX 2025
   Modern • Glass • Gradient • Responsive
============================================================ */

/* ----------------- VARIABLES ----------------- */
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e4dcc;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --info: #0ea5e9;
    --info-light: #38bdf8;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* ----------------- RESET ----------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ec 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    width: 95%;
    max-width: 1750px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----------------- HEADER ----------------- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    margin-bottom: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-info h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.header-info p {
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.header-logo {
    width: 180px;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.header-logo:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ----------------- CARDS ----------------- */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 24px;
}

.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-primary::before { background: var(--primary); }
.card-success::before { background: var(--success); }
.card-warning::before { background: var(--warning); }
.card-purple::before { background: var(--purple); }
.card-danger::before { background: var(--danger); }
.card-info::before { background: var(--info); }

.card-content {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 20px;
    color: white;
}

.card-primary .card-icon { background: var(--primary); }
.card-success .card-icon { background: var(--success); }
.card-warning .card-icon { background: var(--warning); }
.card-purple .card-icon { background: var(--purple); }
.card-danger .card-icon { background: var(--danger); }
.card-info .card-icon { background: var(--info); }

.card h3 {
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

        /*.value {*/
        /*    font-size: 2.2rem;*/
        /*    font-weight: 700;*/
        /*    margin-bottom: 5px;*/
        /*    color: var(--dark);*/
        /*}*/

.card-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 5px;
    color: var(--gray-800);
}

/*.card-trend {*/
/*    display: flex;*/
/*    align-items: center;*/
/*    gap: 4px;*/
/*    font-size: 12px;*/
/*    font-weight: 600;*/
/*    margin-top: 4px;*/
/*}*/

/*.card-trend.up {*/
/*    color: var(--success);*/
/*}*/

/*.card-trend.down {*/
/*    color: var(--danger);*/
/*}*/

/*.card-trend.neutral {*/
/*    color: var(--gray-500);*/
/*}*/

/* ----------------- SETTINGS ----------------- */
.settings-block {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 20px;
    margin-bottom: 24px;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
}

.settings-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.settings-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper select {
    appearance: none;
    width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    background: white;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--gray-500);
}

.select-wrapper i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--gray-500);
    font-size: 12px;
}

.select-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.settings-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ----------------- BUTTONS ----------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #0e9f74;
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* ----------------- CHART ----------------- */
.chart-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 24px;
    margin-bottom: 24px;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-600);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ----------------- TABLE SECTION ----------------- */
.table-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.entries-info {
    font-size: 14px;
    color: var(--gray-600);
}

.table-container {
    overflow: hidden;
    border-radius: var(--border-radius);
}

.table-container-inner {
    max-height: 420px;
    overflow-y: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

table th {
    padding: 14px 12px;
    text-align: left;
    background: var(--gray-100);
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-300);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-700);
}

table tbody tr {
    transition: var(--transition-fast);
}

table tbody tr:hover {
    background: var(--gray-50);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-normal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* PAGINATION */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-container button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pagination-container button:hover:not(.active) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.pagination-container button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----------------- POPUP (GLASS EFFECT) ----------------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 3000;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 460px;
    max-width: 92%;
    max-height: 90vh;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 3100;
    display: none;
    overflow: hidden;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.popup-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.popup-body {
    padding: 20px 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.full-width {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--gray-300);
    font-size: 14px;
    transition: var(--transition);
}

.full-width:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.queue-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.queue-item {
    padding: 12px;
    border-radius: 10px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.queue-item-title {
    font-weight: 600;
    color: var(--gray-800);
}

.queue-item-meta {
    font-size: 12px;
    color: var(--gray-600);
}

/* ----------------- LOADING ----------------- */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loader-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 24px 28px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

/* ----------------- RESPONSIVE ----------------- */
@media (max-width: 1024px) {
    .card-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .settings-grid {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .settings-controls {
        width: 100%;
    }
    
    .settings-controls .select-wrapper select {
        width: 100%;
    }
    
    .settings-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .popup {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .card-container {
        grid-template-columns: 1fr;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .popup-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   PREMIUM ANIMATIONS
============================================================ */

/* Fade-in with slide */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards ease-out;
}

@keyframes fadeInUp {
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Stagger animation for cards */
.card {
    animation: fadeInUp 0.6s forwards ease-out;
    opacity: 0;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }

/* Pulse animation for status */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.status-dot.online {
    animation: pulse 2s infinite;
}

/* Hover effects */
.btn, .card, .header-logo {
    transition: var(--transition);
}

.btn:hover, .card:hover {
    transform: translateY(-3px);
}

/* Chart container animation */
.chart-container {
    animation: fadeInUp 0.7s ease-out;
}

/* Popup animation */
.popup {
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.9); 
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}
