/* High Contrast Color Palette */
:root {
    --text-dark: #1e293b; /* Dark blue-gray for text on light backgrounds */
    --text-light: #f8fafc; /* Off-white for text on dark backgrounds */
    --text-secondary: #64748b; /* Secondary text */
    --bg-light: #ffffff; /* White background */
    --bg-card: #ffffff; /* Card background */
    --bg-header: #1e40af; /* Dark blue header */
    --border-light: #e2e8f0; /* Light borders */
    --border-dark: #334155; /* Dark borders */
    --primary: #2563eb; /* Primary blue */
    --primary-dark: #1e40af; /* Darker blue */
    --success: #10b981; /* Green */
    --danger: #ef4444; /* Red */
    --warning: #f59e0b; /* Orange */
    --info: #3b82f6; /* Light blue */
    --purple: #7c3aed; /* Purple */
    --pink: #ec4899; /* Pink */
}

.nan-dashboard-container { 
    padding: 24px;
    max-width: 1600px; 
    margin: 0 auto; 
    background: #f8fafc; 
    min-height: 100vh;
}

/* Header */
.nan-dashboard-header { 
    background: linear-gradient(135deg, var(--bg-header) 0%, #1e3a8a 100%);
    border-radius: 16px; 
    padding: 28px 32px; 
    margin-bottom: 32px; 
    color: var(--text-light); 
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.2);
}

.header-content { 
    display: flex;
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 28px; 
}

.header-title h1 { 
    color: var(--text-light);
    margin: 0 0 8px 0; 
    font-size: 32px; 
    font-weight: 700; 
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-subtitle { 
    color: rgba(248, 250, 252, 0.9);
    margin: 0 0 6px 0; 
    font-size: 16px; 
    font-weight: 400;
}

.header-date-range { 
    color: rgba(248, 250, 252, 0.9);
    margin: 0; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-weight: 500;
}

.header-actions { 
    display: flex;
    align-items: center; 
    gap: 16px; 
    flex-wrap: wrap; 
}

.date-range-selector { 
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px); 
    border-radius: 12px; 
    padding: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.date-range-form { 
    display: flex;
    align-items: center; 
    gap: 12px; 
}

.range-select { 
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3); 
    color: var(--text-light); 
    border-radius: 8px; 
    padding: 10px 16px; 
    font-size: 14px; 
    min-width: 140px; 
    font-weight: 500;
}

.range-select:focus { 
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); 
    border-color: var(--text-light);
}

.range-select option { 
    color: var(--text-dark);
    background: var(--bg-light);
}

.custom-date-range { 
    display: flex;
    align-items: center; 
    gap: 12px; 
    margin-top: 12px; 
}

.date-input { 
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3); 
    color: var(--text-light); 
    border-radius: 6px; 
    padding: 8px 12px; 
    font-size: 14px; 
    font-weight: 500;
}

.date-input::placeholder { 
    color: rgba(255, 255, 255, 0.7);
}

.export-dropdown { 
    position: relative;
}

.export-btn { 
    display: flex;
    align-items: center; 
    gap: 8px; 
    font-weight: 600;
}

.export-menu { 
    display: none;
    position: absolute; 
    top: 100%; 
    left: 0; 
    background: var(--bg-light); 
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15); 
    min-width: 220px;
    z-index: 1000; 
    margin-top: 8px; 
    overflow: hidden; 
    border: 1px solid var(--border-light);
}

.export-menu.show { 
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.export-item { 
    display: flex;
    align-items: center; 
    gap: 12px; 
    padding: 14px 20px; 
    color: var(--text-dark); 
    text-decoration: none; 
    border-bottom: 1px solid var(--border-light); 
    transition: all 0.2s; 
    font-weight: 500;
}

.export-item:hover { 
    background: #f1f5f9;
    color: var(--primary); 
}

.export-item:last-child { 
    border-bottom: none;
}

/* Buttons */
.button { 
    padding: 10px 20px;
    border: none; 
    border-radius: 10px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.2s; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 14px;
}

.button-primary { 
    background: var(--primary);
    color: var(--text-light); 
    border: 2px solid var(--primary); 
}

.button-primary:hover { 
    background: var(--primary-dark);
    border-color: var(--primary-dark); 
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.button-secondary { 
    background: var(--bg-light);
    color: var(--text-dark); 
    border: 2px solid var(--border-light); 
}

.button-secondary:hover { 
    background: #f8fafc;
    border-color: #cbd5e1; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.button-large { 
    padding: 14px 28px;
    font-size: 16px; 
}

/* Quick Stats */
.quick-stats-bar { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 20px; 
}

.quick-stat { 
    background: var(--bg-light);
    border-radius: 16px; 
    padding: 24px; 
    display: flex; 
    align-items: center; 
    gap: 20px; 
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.quick-stat:hover { 
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-blue { border-top: 4px solid var(--primary); }
.stat-purple { border-top: 4px solid var(--purple); }
.stat-green { border-top: 4px solid var(--success); }
.stat-orange { border-top: 4px solid var(--warning); }

.quick-stat-icon { 
    width: 64px;
    height: 64px; 
    border-radius: 16px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-light); 
    font-size: 28px;
}

.stat-blue .quick-stat-icon { background: var(--primary); }
.stat-purple .quick-stat-icon { background: var(--purple); }
.stat-green .quick-stat-icon { background: var(--success); }
.stat-orange .quick-stat-icon { background: var(--warning); }

.quick-stat-content { 
    flex: 1;
}

.quick-stat-label { 
    display: block;
    font-size: 12px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--text-secondary); 
    font-weight: 600; 
    margin-bottom: 4px;
}

.quick-stat-value { 
    display: block;
    font-size: 32px; 
    font-weight: 800; 
    margin: 8px 0; 
    color: var(--text-dark); 
    line-height: 1;
}

.quick-stat-change { 
    font-size: 13px;
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    margin-top: 4px;
}

.quick-stat-change.positive { 
    color: var(--success);
}

.quick-stat-change.negative { 
    color: var(--danger);
}

.quick-stat-subtext { 
    font-size: 13px;
    color: var(--text-secondary); 
    display: block; 
    margin-top: 2px;
}

/* Dashboard Grid */
.nan-dashboard-grid { 
    display: grid;
    grid-template-columns: 2fr 1fr; 
    gap: 28px; 
    margin-bottom: 32px; 
}

@media (max-width: 1200px) { 
    .nan-dashboard-grid { 
        grid-template-columns: 1fr;
    } 
}

/* Cards */
.dashboard-card { 
    background: var(--bg-card);
    border-radius: 16px; 
    margin-bottom: 28px; 
    overflow: hidden; 
    transition: all 0.3s; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.dashboard-card:hover { 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header { 
    padding: 24px;
    border-bottom: 1px solid var(--border-light); 
}

.card-header h3 { 
    margin: 0;
    font-size: 18px; 
    font-weight: 600; 
    color: var(--text-dark); 
    display: flex; 
    align-items: center; 
    gap: 12px;
}

/* Enhanced Traffic Overview Header */
.card-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
}

.card-title-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-range-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-label {
    font-size: 13px;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.traffic-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-change {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.card-actions { 
    display: flex;
    align-items: center; 
    gap: 16px; 
}

.stats-summary { 
    font-size: 14px;
    color: var(--text-secondary); 
    font-weight: 500;
}

.card-badge { 
    background: var(--primary);
    color: var(--text-light); 
    font-size: 11px; 
    font-weight: 600; 
    padding: 4px 12px; 
    border-radius: 20px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.card-body { 
    padding: 24px;
}

/* Enhanced Chart Container */
.chart-container {
    position: relative;
    height: 250px;
    margin-bottom: 16px;
}

.chart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--primary);
}

.legend-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.chart-summary {
    text-align: right;
}

.summary-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Top List */
.top-list-item { 
    display: flex;
    align-items: center; 
    padding: 16px 0; 
    border-bottom: 1px solid var(--border-light); 
    transition: all 0.2s;
}

.top-list-item:hover { 
    background: #f8fafc;
}

.top-list-item:last-child { 
    border-bottom: none;
}

.item-rank { 
    width: 40px;
    height: 40px; 
    border-radius: 10px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 700; 
    margin-right: 16px; 
    color: var(--text-light); 
    font-size: 16px;
}

.rank-1 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); }
.rank-4 { background: linear-gradient(135deg, #6b7280, #4b5563); }
.rank-5 { background: linear-gradient(135deg, #4b5563, #374151); }

.item-avatar { 
    width: 48px;
    height: 48px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-light); 
    font-weight: 700; 
    font-size: 20px; 
    margin-right: 16px;
}

.avatar-1 { background: linear-gradient(135deg, var(--primary), #3b82f6); }
.avatar-2 { background: linear-gradient(135deg, var(--purple), #8b5cf6); }
.avatar-3 { background: linear-gradient(135deg, var(--success), #34d399); }
.avatar-4 { background: linear-gradient(135deg, var(--warning), #fbbf24); }
.avatar-5 { background: linear-gradient(135deg, var(--pink), #f472b6); }

.item-content { 
    flex: 1;
}

.item-title { 
    font-weight: 600;
    margin-bottom: 6px; 
    color: var(--text-dark); 
    font-size: 15px;
}

.item-title a { 
    text-decoration: none;
    color: var(--text-dark); 
    transition: color 0.2s; 
}

.item-title a:hover { 
    color: var(--primary);
}

.item-meta { 
    font-size: 13px;
    color: var(--text-secondary); 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* Empty State */
.empty-state { 
    text-align: center;
    padding: 60px 24px; 
    color: var(--text-secondary); 
}

.empty-state .dashicons { 
    font-size: 64px;
    color: #cbd5e1; 
    margin-bottom: 20px; 
    display: block; 
}

.empty-state p { 
    margin: 0 0 20px 0;
    font-size: 16px; 
    font-weight: 500;
}

/* Section Header */
.section-header { 
    display: flex;
    justify-content: space-between; 
    align-items: center; 
    margin: 40px 0 20px 0; 
}

.section-header h2 { 
    margin: 0;
    font-size: 24px; 
    color: var(--text-dark); 
    font-weight: 700;
}

.section-actions { 
    display: flex;
    align-items: center; 
    gap: 16px; 
}

/* Table Styles */
.table-actions { 
    padding: 20px 24px;
    background: #f8fafc; 
    border-bottom: 1px solid var(--border-light); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.table-summary { 
    font-size: 14px;
    color: var(--text-secondary); 
    font-weight: 500;
}

.wp-list-table { 
    background: var(--bg-light);
    border: 1px solid var(--border-light);
}

.wp-list-table thead th { 
    background: #f1f5f9;
    color: var(--text-dark); 
    font-weight: 600; 
    border-bottom: 2px solid var(--primary); 
    padding: 16px 12px;
}

.wp-list-table tbody td { 
    padding: 16px 12px;
    color: var(--text-dark); 
    vertical-align: middle;
}

.subscriber-info { 
    display: flex;
    flex-direction: column; 
}

.subscriber-info strong { 
    color: var(--text-dark);
    font-weight: 600; 
    margin-bottom: 4px;
}

.subscriber-info small { 
    color: var(--text-secondary);
    font-size: 12px; 
}

.api-key-display { 
    display: flex;
    align-items: center; 
    gap: 8px; 
}

.api-key-display code { 
    background: #f1f5f9;
    color: var(--text-dark); 
    padding: 6px 10px; 
    border-radius: 6px; 
    font-size: 12px; 
    flex: 1; 
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    border: 1px solid var(--border-light);
}

.highlight-pink { 
    color: var(--pink) !important;
    font-weight: 700;
}

.total-views { 
    color: var(--text-secondary);
    font-size: 13px; 
    font-weight: 500;
}

.rate-limit { 
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f1f5f9; 
    color: var(--text-dark); 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px; 
    font-weight: 600; 
    border: 1px solid var(--border-light);
}

.status-badge { 
    display: inline-flex;
    align-items: center; 
    gap: 6px; 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.status-badge.status-active { 
    background: #dcfce7;
    color: #166534; 
    border: 1px solid #86efac;
}

.status-badge.status-inactive { 
    background: #fef3c7;
    color: #92400e; 
    border: 1px solid #fcd34d;
}

.status-badge.status-suspended { 
    background: #fee2e2;
    color: #991b1b; 
    border: 1px solid #fca5a5;
}

.action-buttons { 
    display: flex;
    gap: 6px; 
}

.button-icon { 
    width: 36px;
    height: 36px; 
    border-radius: 8px; 
    border: 1px solid var(--border-light); 
    background: var(--bg-light); 
    color: var(--text-secondary); 
    cursor: pointer; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    text-decoration: none; 
    transition: all 0.2s;
}

.button-icon:hover { 
    background: #f1f5f9;
    color: var(--primary); 
    border-color: #cbd5e1;
}

.button-danger { 
    color: var(--danger);
    border-color: var(--danger); 
}

.button-danger:hover { 
    background: var(--danger);
    color: var(--text-light); 
}

/* Form Styles */
.form-grid { 
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 32px; 
}

@media (max-width: 768px) { 
    .form-grid { 
        grid-template-columns: 1fr;
    } 
}

.form-group { 
    margin-bottom: 24px;
}

.form-group label { 
    display: block;
    margin-bottom: 8px; 
    color: var(--text-dark); 
    font-weight: 600; 
    font-size: 14px;
}

.form-input { 
    width: 100%;
    padding: 12px 16px; 
    border: 2px solid var(--border-light); 
    border-radius: 8px; 
    font-size: 14px; 
    transition: all 0.2s; 
    color: var(--text-dark);
    background: var(--bg-light);
}

.form-input:focus { 
    outline: none;
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-hint { 
    display: block;
    margin-top: 6px; 
    color: var(--text-secondary); 
    font-size: 12px; 
    line-height: 1.4;
}

.category-selector { 
    border: 2px solid var(--border-light);
    border-radius: 8px; 
    overflow: hidden; 
}

.category-selector-header { 
    padding: 16px;
    background: #f8fafc; 
    border-bottom: 1px solid var(--border-light); 
}

.category-selector-header label { 
    display: flex;
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    font-weight: 600; 
    color: var(--text-dark);
}

.category-grid { 
    max-height: 200px;
    overflow-y: auto; 
    padding: 16px; 
}

.category-checkbox { 
    display: flex;
    align-items: center; 
    padding: 12px; 
    cursor: pointer; 
    border-radius: 6px; 
    position: relative; 
    transition: background 0.2s;
}

.category-checkbox:hover { 
    background: #f8fafc;
}

.category-checkbox input { 
    margin-right: 10px;
}

.checkbox-checkmark { 
    position: absolute;
    left: 16px; 
    width: 18px; 
    height: 18px; 
    border: 2px solid var(--border-light); 
    border-radius: 4px; 
    background: var(--bg-light);
}

.category-checkbox input:checked + .checkbox-checkmark { 
    background: var(--primary);
    border-color: var(--primary); 
}

.category-checkbox input:checked + .checkbox-checkmark::after { 
    content: '';
    position: absolute; 
    left: 5px; 
    top: 2px; 
    width: 6px; 
    height: 10px; 
    border: solid var(--text-light); 
    border-width: 0 2px 2px 0; 
    transform: rotate(45deg);
}

.category-name { 
    flex: 1;
    margin-left: 32px; 
    color: var(--text-dark); 
    font-weight: 500;
}

.category-count { 
    color: var(--text-secondary);
    font-size: 12px; 
    font-weight: 500;
}

.form-actions { 
    padding-top: 28px;
    border-top: 1px solid var(--border-light); 
    text-align: center; 
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .date-range-form {
        flex-wrap: wrap;
    }
    
    .quick-stats-bar {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .nan-dashboard-container {
        padding: 16px;
    }
    
    .nan-dashboard-header {
        padding: 20px 24px;
    }
    
    .header-title h1 {
        font-size: 28px;
    }
    
    .quick-stats-bar {
        grid-template-columns: 1fr;
    }
    
    .card-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .traffic-stats {
        justify-content: space-between;
        width: 100%;
    }
    
    .stat-item {
        align-items: flex-start;
    }
    
    .chart-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .chart-summary {
        text-align: left;
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .section-actions {
        width: 100%;
    }
    
    .wp-list-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}