/* ========================================
   BASE STYLES
   Resets, body, and fundamental HTML elements
   ======================================== */

/* ========================================
   CSS RESET (Box Model & Defaults)
   ======================================== */

/* Apply border-box to everything for easier sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========================================
   BODY & HTML
   ======================================== */

html {
    /* Smooth scrolling for anchor links */
    scroll-behavior: smooth;
}

body {
    /* Typography */
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);

    /* Colors */
    background: var(--color-bg-page);
    color: var(--color-text-secondary);

    /* Layout: Flexbox for sidebar + main-content side-by-side */
    display: flex;
    height: 100vh;
    overflow: hidden;

    /* Prevents text selection on UI elements */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   HEADINGS
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    line-height: var(--line-height-tight);
}

h1 {
    font-size: var(--font-size-2xl);
}

h2 {
    font-size: var(--font-size-xl);
}

h3 {
    font-size: var(--font-size-lg);
}

/* ========================================
   LINKS
   ======================================== */

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-primary);
}

/* ========================================
   BUTTONS (Base Styles)
   ======================================== */

button {
    /* Reset browser defaults */
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;

    /* Remove default focus outline */
    outline: none;

    /* Smooth transitions */
    transition: all var(--transition-base);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Note: Specific button styles (primary, ghost, etc.)
   are in components/buttons.css */


/* ========================================
   FORM ELEMENTS (Base Styles)
   ======================================== */

input, 
textarea, 
select {
    /* Reset browser defaults */
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;

    /* Smooth transitions */
    transition: all var(--transition-base);
}

/* Remove number input spinners (arrows) */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Note: Specific form styles are in components/forms.css

/* ========================================
   IMAGES
   ======================================== */

img {
    /* Responsive images */
    max-width: 100%;
    height: auto;

    /* Remove extra space below images */
    display: block;
}

/* ========================================
   SCROLLBARS (Custom Style for Dark Theme)
   ======================================== */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-elevated) var(--color-bg-page);
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* ========================================
   UTILITY CLASSES (Helpful Shortcuts)
   ======================================== */

/* Hide visually but keep for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* hide completely */
.hidden {
    display: none !important;
}

/* Text utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Truncate text with ellipsis (...) */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   FOCUS STYLES (Accessibility)
   ======================================== */

/* Better focus indicator for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   SELECTION (Text Highlight)
   ======================================== */

::selection {
    background: var(--color-primary);
    color: var(--color-text-primary);
}

::-moz-selection {
    background: var(--color-primary);
    color: var(--color-text-primary);
}

/* This makes selected text use brand color */

/* ============================================
   DEMO BANNER
   Shows at top of all pages in demo mode
   ============================================ */

.demo-banner {
    /* Positioning */
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;  /* Above everything */
    
    /* Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Sizing */
    padding: 12px 20px;
    
    /* Styling */
    background: linear-gradient(135deg, 
        rgba(230, 0, 48, 0.95), 
        rgba(200, 0, 40, 0.95)
    );
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);

    transition: opacity 0.3s ease, transform 0.3s ease;
}

.demo-banner-content {
    /* Layout */
    display: flex;
    align-items: center;
    gap: 12px;
    
    /* Typography */
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
}

.demo-banner-content i {
    /* Icon styling */
    font-size: 1.1rem;
    flex-shrink: 0;
}

.demo-banner-text {
    /* Layout */
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.demo-banner-text strong {
    /* Emphasis */
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Adjust page layout to account for banner */
body {
    padding-top: 48px;  /* Height of banner */
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .demo-banner {
        padding: 10px 16px;
    }
    
    .demo-banner-content {
        font-size: 0.8rem;
    }
    
    .demo-banner-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    body {
        padding-top: 60px;  /* Slightly taller on mobile */
    }
}

.demo-banner-close {
    /* Reset button styles */
    background: none;
    border: none;
    padding: 4px 8px;
    
    /* Styling */
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 1rem;
    
    /* Animation */
    transition: all 0.2s ease;
}

.demo-banner-close:hover {
    color: #fff;
    transform: scale(1.1);
}