/* ============================================
   Base Styles - Reset & Typography
   ============================================ */

/* Geist Font Import */
@import url('https://cdn.jsdelivr.net/npm/geist@1.2.0/dist/fonts/geist-sans/style.css');
@import url('https://cdn.jsdelivr.net/npm/geist@1.2.0/dist/fonts/geist-mono/style.css');

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ----------------------------------------
   Theme Transition
   ---------------------------------------- */
html,
body,
.header,
.sidebar,
.content-panel,
.card,
.btn,
.modal,
.toast {
    transition: 
        background-color var(--transition-theme),
        border-color var(--transition-theme),
        color var(--transition-theme);
}

/* Disable transitions on initial load */
html:not([data-theme-ready]) * {
    transition: none !important;
}

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

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
    color: var(--color-text-secondary);
    font-size: var(--text-base);
}

a {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-text-link-hover);
    text-decoration: underline;
}

strong, b {
    font-weight: var(--font-semibold);
}

small {
    font-size: var(--text-sm);
}

/* ----------------------------------------
   Code & Monospace
   ---------------------------------------- */
code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

code {
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
}

pre {
    background: var(--color-bg-code);
    color: var(--color-text-code);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    line-height: var(--leading-relaxed);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ----------------------------------------
   Lists
   ---------------------------------------- */
ul, ol {
    padding-left: var(--space-6);
    font-size: var(--text-base);
}

li {
    margin-bottom: var(--space-2);
}

/* ----------------------------------------
   Form Elements Base
   ---------------------------------------- */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

input,
textarea,
select {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-primary);
    font-size: var(--text-base);
    transition: 
        border-color var(--transition-fast), 
        box-shadow var(--transition-fast),
        background-color var(--transition-theme);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: var(--shadow-focus);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ----------------------------------------
   Tables
   ---------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    font-size: var(--text-sm);
}

tr:hover td {
    background: var(--color-bg-hover);
}

/* ----------------------------------------
   Media
   ---------------------------------------- */
img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ----------------------------------------
   Scrollbar Styling
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    border: 2px solid var(--scrollbar-track);
}

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ----------------------------------------
   Selection
   ---------------------------------------- */
::selection {
    background: var(--color-primary-200);
    color: var(--color-primary-900);
}

[data-theme="dark"] ::selection {
    background: var(--color-primary-700);
    color: var(--color-primary-100);
}

/* ----------------------------------------
   Focus Visible
   ---------------------------------------- */
:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ----------------------------------------
   Utility Classes
   ---------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mono {
    font-family: var(--font-mono);
}

/* Text sizes utility classes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

/* Text colors utility classes */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

/* ----------------------------------------
   Grid Utilities
   ---------------------------------------- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ----------------------------------------
   Content Section
   ---------------------------------------- */
.content-section {
    margin-bottom: var(--space-6);
}

.content-section-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}
