/* Custom styles for data visualization app */

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #1f2937; /* gray-800 */
}

::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

/* Animation for loading */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Dashboard grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

/* Chart container with aspect ratio */
.chart-aspect-container {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
}

.chart-aspect-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Gradient backgrounds */
.bg-gradient-dark {
    background: linear-gradient(to right, #111827, #1f2937);
}

.bg-gradient-card {
    background: linear-gradient(to bottom right, #1f2937, #111827);
}

.bg-gradient-blue {
    background: linear-gradient(to right, #2563eb, #3b82f6);
}

/* Glowing effects */
.glow-blue {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.hover-glow-blue:hover {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
}

/* Text gradient */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(to right, #3b82f6, #60a5fa);
}

/* File upload drop visual feedback */
.drop-active {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

/* Chart toolbar */
.chart-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: rgba(31, 41, 55, 0.95);
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    transition: background 0.2s;
}

.chart-toolbar button {
    transition: color 0.2s, background 0.2s;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.chart-toolbar button:hover {
    background: #2563eb;
    color: #fff;
}

/* Legend styling */
.custom-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    background: rgba(31,41,55,0.8);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.5rem;
}

/* Data table styling */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: #1f2937;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #374151;
}

.data-table tbody tr:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

/* Tooltip styling */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    visibility: hidden;
    width: 200px;
    background-color: #111827;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.custom-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Notification styling */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-width: 24rem;
}

/* Fade in/out animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

/* See More Charts Animation */
.animate-fade-in {
    animation: fadeInUp 0.5s ease-in-out;
}

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

body {
    background: #111827;
    color: #e5e7eb;
    transition: background 0.3s, color 0.3s;
}

.card, .chart-container {
    background: linear-gradient(135deg, #1a202e 60%, #232946 100%);
    border-radius: 1rem;
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.25);
    transition: box-shadow 0.2s, background 0.3s;
}

.card:hover, .chart-container:hover {
    box-shadow: 0 8px 32px 0 rgba(59,130,246,0.15);
}

a, .text-blue-500 {
    color: #3b82f6;
    transition: color 0.2s;
}

a:hover, .text-blue-500:hover {
    color: #60a5fa;
}

/* === Accessibility + Production palette (WCAG-friendly) === */
:root {
  --bg: #0b1120;              /* slate-950 */
  --surface: #111827;         /* gray-900 */
  --surface-2: #1f2937;       /* gray-800 */
  --text: #e5e7eb;            /* gray-200 */
  --muted: #9ca3af;           /* gray-400 */
  --primary: #1d4ed8;         /* blue-700 */
  --primary-hover: #1e40af;   /* blue-800 */
  --accent: #06b6d4;          /* cyan-500 */
  --danger: #dc2626;          /* red-600 */
  --warning: #f59e0b;         /* amber-500 */
  --success: #16a34a;         /* green-600 */
  --focus: #93c5fd;           /* blue-300 */
  --border: #334155;          /* slate-700 */
}

body { background: var(--bg); color: var(--text); }

/* Links: ensure >= 4.5:1 contrast on dark bg */
a { color: #93c5fd; }
a:hover { color: #bfdbfe; }

/* Navbar links - no underline on hover */
nav a:hover {
    text-decoration: none !important;
}

/* Cards and containers with clearer borders */
.card, .chart-container, .bg-gradient-card, .bg-gradient-dark {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
}

/* Buttons (non-Tailwind elements) */
.btn-accessible {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.625rem 1rem; border-radius: 0.5rem; font-weight: 600;
  color: #fff; background: var(--primary); border: 1px solid transparent;
}
.btn-accessible:hover { background: var(--primary-hover); }
.btn-accessible:focus { outline: 2px solid var(--focus); outline-offset: 3px; }
.btn-outline { color: #fff; background: transparent; border: 1px solid var(--border); }
.btn-outline:hover { background: rgba(148,163,184,0.12); }

/* Inputs */
input[type="text"], input[type="number"], select, textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.5rem 0.75rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }

/* Tables */
.data-table th { background-color: var(--surface-2); color: var(--text); }
.data-table td { border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background-color: rgba(148,163,184,0.08); }

/* Alerts */
.alert {
  padding: 0.75rem 1rem; border-radius: 0.5rem; border: 1px solid var(--border);
}
.alert-danger { background: rgba(220,38,38,0.12); color: #fecaca; border-color: rgba(220,38,38,0.35); }
.alert-warning { background: rgba(245,158,11,0.12); color: #fde68a; border-color: rgba(245,158,11,0.35); }
.alert-success { background: rgba(22,163,74,0.12); color: #bbf7d0; border-color: rgba(22,163,74,0.35); }

/* Focus styles globally for keyboard nav */
*:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Chart.js axes/grid colors for dark bg */
.chartjs-dark-theme {
  --grid: rgba(148,163,184,0.2);
  --tick: #cbd5e1;
}

/* Admin Dropdown Menu Styles */
.admin-dropdown {
  position: relative;
}

.admin-dropdown .dropdown-content {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  width: 12rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease-in-out;
  z-index: 9999;
  pointer-events: none;
  min-width: 200px;
}

.admin-dropdown:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.admin-dropdown .dropdown-content a {
  display: block;
  padding: 0.75rem 1rem;
  color: #d1d5db;
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px solid #374151;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.admin-dropdown .dropdown-content a:last-child {
  border-bottom: none;
}

.admin-dropdown .dropdown-content a:hover {
  background: #374151;
  color: #ffffff;
  padding-left: 1.25rem;
}

.admin-dropdown .dropdown-content a.active {
  background: #3b82f6;
  color: #ffffff;
}

.admin-dropdown .dropdown-content a i {
  margin-right: 0.5rem;
  width: 1rem;
  text-align: center;
  color: #9ca3af;
}

.admin-dropdown .dropdown-content a:hover i {
  color: #ffffff;
}

/* Dropdown arrow animation */
.admin-dropdown .dropdown-arrow {
  transition: transform 0.2s ease;
}

.admin-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

/* Ensure dropdown is visible on hover */
.admin-dropdown:hover .dropdown-content {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Mobile admin section styling */
.mobile-admin-section {
  border-top: 1px solid #374151;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.mobile-admin-section .admin-label {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.mobile-admin-section a {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  margin: 0.125rem 0;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.mobile-admin-section a:hover {
  background: #374151;
  color: #ffffff;
  transform: translateX(0.25rem);
}

/* Fix navbar underline issue */
nav a:hover {
  text-decoration: none !important;
}
