/* ===== CSS Variables ===== */
:root {
    --bg-color: #0a0b14;
    --card-bg: rgba(20, 25, 40, 0.7);
    --primary-color: #00f3ff;
    --secondary-color: #bc13fe;
    --success-color: #00ff9d;
    --warning-color: #ffb800;
    --error-color: #ff0055;
    --text-primary: #e8eaf6;
    --text-secondary: rgba(232, 234, 246, 0.55);
    --border-color: rgba(0, 243, 255, 0.12);
    --border-hover: rgba(0, 243, 255, 0.35);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Background Grid ===== */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.bg-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 800px 600px at 20% 20%, rgba(0, 243, 255, 0.06), transparent),
        radial-gradient(ellipse 600px 500px at 80% 80%, rgba(188, 19, 254, 0.05), transparent);
}

/* ===== Floating Orbs ===== */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(0, 243, 255, 0.07);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: rgba(188, 19, 254, 0.06);
    bottom: -50px;
    right: -80px;
    animation-delay: -7s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: rgba(0, 255, 157, 0.05);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 50px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.02); }
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ===== Card Base ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.06);
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px var(--primary-color));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 12px var(--primary-color)); }
    50% { filter: drop-shadow(0 0 24px var(--primary-color)) drop-shadow(0 0 48px rgba(0, 243, 255, 0.3)); }
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.logo-highlight {
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.subtitle-divider {
    color: var(--secondary-color);
    margin: 0 4px;
}

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

/* ===== Buttons ===== */
.btn {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-icon {
    font-size: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(0, 243, 255, 0.05));
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1), inset 0 0 20px rgba(0, 243, 255, 0.05);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(0, 243, 255, 0.1));
    box-shadow:
        0 0 30px rgba(0, 243, 255, 0.25),
        0 0 60px rgba(0, 243, 255, 0.1),
        inset 0 0 30px rgba(0, 243, 255, 0.1);
    transform: translateY(-1px);
    text-shadow: 0 0 10px var(--primary-color);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(188, 19, 254, 0.1), rgba(188, 19, 254, 0.03));
    border-color: rgba(188, 19, 254, 0.4);
    color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.05);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(188, 19, 254, 0.25), rgba(188, 19, 254, 0.08));
    border-color: var(--secondary-color);
    box-shadow:
        0 0 25px rgba(188, 19, 254, 0.2),
        0 0 50px rgba(188, 19, 254, 0.08),
        inset 0 0 25px rgba(188, 19, 254, 0.08);
    transform: translateY(-1px);
    text-shadow: 0 0 10px var(--secondary-color);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

/* ===== Status Bar ===== */
.status-bar {
    border-radius: var(--radius-sm);
    padding: 0;
    margin-bottom: 28px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.3px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-bar.visible {
    padding: 14px 20px;
    max-height: 120px;
    opacity: 1;
}

.status-bar.status-success {
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.1), rgba(0, 255, 157, 0.03));
    border: 1px solid rgba(0, 255, 157, 0.25);
    color: var(--success-color);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.05);
}

.status-bar.status-error {
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.1), rgba(255, 0, 85, 0.03));
    border: 1px solid rgba(255, 0, 85, 0.25);
    color: var(--error-color);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.05);
}

.status-bar.status-loading {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1), rgba(0, 243, 255, 0.03));
    border: 1px solid rgba(0, 243, 255, 0.2);
    color: var(--primary-color);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 243, 255, 0.05); }
    50% { box-shadow: 0 0 25px rgba(0, 243, 255, 0.12); }
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-total {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(0, 243, 255, 0.05));
    color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
}

.stat-icon-pending {
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.15), rgba(255, 184, 0, 0.05));
    color: var(--warning-color);
    box-shadow: 0 0 20px rgba(255, 184, 0, 0.1);
}

.stat-icon-replied {
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.15), rgba(0, 255, 157, 0.05));
    color: var(--success-color);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.1);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-family: var(--font-mono);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary), rgba(232, 234, 246, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 var(--radius) var(--radius);
}

.stat-bar-total {
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.6;
}

.stat-bar-pending {
    background: linear-gradient(90deg, transparent, var(--warning-color), transparent);
    opacity: 0.6;
}

.stat-bar-replied {
    background: linear-gradient(90deg, transparent, var(--success-color), transparent);
    opacity: 0.6;
}

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    padding: 28px;
}

.card-title {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.card-title-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 8px var(--primary-color); }
    50% { box-shadow: 0 0 16px var(--primary-color), 0 0 30px rgba(0, 243, 255, 0.3); }
}

.chart-wrapper {
    position: relative;
    width: 100%;
    max-height: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chart-wrapper canvas {
    max-height: 300px;
}

/* ===== Table ===== */
.table-card {
    padding: 28px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.2);
    border-radius: 3px;
}

#dataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#dataTable thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

#dataTable th {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--primary-color);
    background: rgba(0, 243, 255, 0.06);
    padding: 14px 18px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
}

#dataTable td {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 13px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#dataTable tbody tr {
    transition: background var(--transition);
}

#dataTable tbody tr:hover {
    background: rgba(0, 243, 255, 0.04);
}

#dataTable tbody tr:last-child td {
    border-bottom: none;
}

.no-data {
    text-align: center;
    padding: 48px 20px !important;
    color: var(--text-secondary) !important;
    font-family: var(--font-mono) !important;
    font-size: 14px !important;
    letter-spacing: 1px;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 32px 0 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.footer-version {
    color: var(--primary-color);
    opacity: 0.7;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    animation: fadeInUp 0.6s ease-out;
}

.stat-card:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.1s both; }
.stat-card:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.2s both; }
.stat-card:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.3s both; }

.chart-card:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.35s both; }
.chart-card:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.45s both; }

.table-card { animation: fadeInUp 0.6s ease-out 0.5s both; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
    }

    .header-right .btn {
        flex: 1;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 20px 16px;
    }

    .logo-text {
        font-size: 18px;
    }

    .stat-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .header-right {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
