/* Dark Theme Styles */

:root {
    --color-light-bg: #ffffff;
    --color-light-fg: #000000;
    --color-light-border: #e5e7eb;
    --color-light-hover: #f3f4f6;
    --color-dark-bg: #0f172a;
    --color-dark-fg: #f1f5f9;
    --color-dark-border: #334155;
    --color-dark-hover: #1e293b;
}


/* Light Theme (Default) */

:root:not(.dark) {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --header-bg: #1d4ed8;
    --header-text: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #1f2937;
    --card-bg: #ffffff;
    --card-hover: #f9fafb;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-focus: #3b82f6;
}

body {
    font-family: var(--site-font-family, "Open Sans", "Segoe UI", sans-serif);
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}


/* Dark Theme */

:root.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #475569;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --header-bg: #0f172a;
    --header-text: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --card-bg: #1e293b;
    --card-hover: #334155;
    --input-bg: #1e293b;
    --input-border: #475569;
    --input-focus: #0ea5e9;
}


/* Global Dark Mode Styles */

:root.dark body {
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.16), transparent 28%),
        linear-gradient(180deg, #0f172a 0%, #111827 45%, #0b1220 100%);
    color: var(--text-primary);
}

:root.dark {
    color-scheme: dark;
}


/* Body */

:root.dark body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

:root.dark header,
:root.dark nav,
:root.dark footer {
    background-color: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(18px);
    border-color: rgba(148, 163, 184, 0.16);
}


/* Headers */

:root.dark h1,
:root.dark h2,
:root.dark h3,
:root.dark h4,
:root.dark h5,
:root.dark h6 {
    color: var(--text-primary);
}


/* Text */

:root.dark p {
    color: var(--text-secondary);
}

:root.dark .text-gray-900,
:root.dark .text-gray-800 {
    color: var(--text-primary);
}

:root.dark .text-gray-700,
:root.dark .text-gray-600 {
    color: var(--text-secondary);
}

:root.dark .text-gray-500,
:root.dark .text-gray-400 {
    color: var(--text-tertiary);
}

:root.dark a {
    color: #3b82f6;
}

:root.dark a:hover {
    color: #60a5fa;
}


/* Buttons */

:root.dark button,
:root.dark .btn {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

:root.dark button:hover,
:root.dark .btn:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}


/* Cards and Containers */

:root.dark .bg-white {
    background-color: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    border-color: var(--border-color);
}

:root.dark .bg-gray-50 {
    background-color: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
}

:root.dark .bg-gray-100 {
    background-color: rgba(30, 41, 59, 0.92);
    color: var(--text-primary);
}

:root.dark .bg-blue-50 {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #475569;
}

:root.dark .bg-green-50 {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #475569;
}

:root.dark .bg-orange-50 {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #475569;
}

:root.dark .bg-red-50 {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #475569;
}


/* Input Fields */

:root.dark input,
:root.dark textarea,
:root.dark select {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}

:root.dark input::placeholder,
:root.dark textarea::placeholder {
    color: var(--text-tertiary);
}

:root.dark input:focus,
:root.dark textarea:focus,
:root.dark select:focus {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-focus);
    outline: none;
}


/* Borders */

:root.dark .border {
    border-color: var(--border-color);
}

:root.dark .border-t,
:root.dark .border-b,
:root.dark .border-l,
:root.dark .border-r {
    border-color: var(--border-color);
}


/* Shadow */

:root.dark .shadow,
:root.dark .shadow-sm,
:root.dark .shadow-md,
:root.dark .shadow-lg {
    box-shadow: 0 18px 45px rgba(2, 6, 23, 0.32);
}

:root.dark .border-gray-200,
:root.dark .border-gray-300,
:root.dark .border-gray-100,
:root.dark .border-gray-700 {
    border-color: var(--border-color);
}

:root.dark .bg-gradient-to-r.from-white,
:root.dark .bg-gradient-to-br.from-white,
:root.dark .bg-gradient-to-b.from-white {
    color: var(--text-primary);
}


/* Hover States */

:root.dark .hover\:bg-gray-100:hover {
    background-color: var(--card-hover);
}

:root.dark .hover\:bg-gray-200:hover {
    background-color: var(--card-hover);
}


/* Sidebar */

:root.dark #sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
}

:root.dark #hero-carousel,
:root.dark .cat-card,
:root.dark .group,
:root.dark .rounded-3xl,
:root.dark .rounded-2xl {
    box-shadow: 0 18px 45px rgba(2, 6, 23, 0.18);
}

:root.dark .sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
}


/* Navigation */

:root.dark nav {
    background-color: var(--header-bg);
    color: var(--header-text);
}

:root.dark header {
    background-color: var(--header-bg);
    color: var(--header-text);
}


/* Tables */

:root.dark table {
    color: var(--text-primary);
    border-color: var(--border-color);
}

:root.dark th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

:root.dark td {
    border-color: var(--border-color);
}

:root.dark tr:hover {
    background-color: var(--card-hover);
}


/* Code */

:root.dark code {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}


/* Overlay */

:root.dark .bg-black {
    background-color: rgba(0, 0, 0, 0.8);
}


/* Scrollbar */

:root.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:root.dark ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

:root.dark ::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

:root.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}


/* Text Colors */

:root.dark .text-gray-900 {
    color: var(--text-primary);
}

:root.dark .text-gray-800 {
    color: var(--text-primary);
}

:root.dark .text-gray-700 {
    color: var(--text-secondary);
}

:root.dark .text-gray-600 {
    color: var(--text-secondary);
}

:root.dark .text-gray-500 {
    color: var(--text-tertiary);
}

:root.dark .text-gray-400 {
    color: var(--text-tertiary);
}

:root.dark .text-gray-300 {
    color: var(--text-tertiary);
}

:root.dark .text-white {
    color: var(--text-primary);
}


/* Specific Component Colors */

:root.dark .text-blue-600 {
    color: #60a5fa;
}

:root.dark .text-green-600 {
    color: #4ade80;
}

:root.dark .text-red-600 {
    color: #f87171;
}

:root.dark .text-orange-600 {
    color: #fb923c;
}

:root.dark .bg-blue-600 {
    background-color: #1e40af;
}

:root.dark .bg-green-600 {
    background-color: #16a34a;
}

:root.dark .bg-red-600 {
    background-color: #dc2626;
}

:root.dark .hover\:bg-blue-600:hover {
    background-color: #1e40af;
}

:root.dark .hover\:bg-green-600:hover {
    background-color: #16a34a;
}


/* Focus States */

:root.dark .focus\:outline-none:focus {
    outline: none;
}

:root.dark .focus\:ring:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* Additional Utility Classes */

:root.dark .divide-gray-200 {
    border-color: var(--border-color);
}

:root.dark .divide-y>*+* {
    border-color: var(--border-color);
}


/* Modal/Dialog */

:root.dark .modal,
:root.dark [role="dialog"] {
    background-color: var(--card-bg);
    color: var(--text-primary);
}


/* Smooth transitions for theme changes */

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ====== ANNOUNCEMENT TAB STYLES ====== */
/* Make announcement tab thinner and more compact */
.announcement-tab {
    padding: 0.5rem 1rem !important; /* Reduced from py-3 px-4 */
    font-size: 0.75rem !important; /* Smaller font */
}

/* Reduce height of announcement bar */
.announcement-bar {
    padding: 0.5rem 1rem !important;
}

.announcement-bar .uppercase {
    font-size: 0.65rem !important;
    letter-spacing: 0.1em;
}

.announcement-bar span {
    font-size: 0.75rem !important;
}

/* Responsive announcement sizing */
@media (max-width: 640px) {
    .announcement-bar {
        padding: 0.375rem 0.75rem !important;
    }

    .announcement-bar .uppercase {
        font-size: 0.6rem !important;
    }

    .announcement-bar span {
        font-size: 0.7rem !important;
    }
}

/* ====== SMART HEADER SCROLL BEHAVIOR ====== */
/* Header should smoothly transition */
header.sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hide header when scrolling down */
header.scroll-hide {
    transform: translateY(-100%);
    box-shadow: none;
}

/* Show header when scrolling up */
header.scroll-show {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Ensure announcement bar follows header behavior */
.announcement-bar {
    transition: transform 0.3s ease;
}

.announcement-bar.scroll-hide {
    transform: translateY(-100%);
}

.announcement-bar.scroll-show {
    transform: translateY(0);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* ====== HEADER LAYOUT OPTIMIZATION ====== */
/* Reduce unnecessary spacing in header when space is constrained */
@media (max-width: 1024px) {
    header .gap-4 {
        gap: 0.5rem;
    }
}

/* Ensure header content remains aligned */
header {
    position: relative;
    z-index: 30;
}