/*
 * Doggy Dashboard - Reset & Base Styles
 * ======================================
 * Consolidated reset, base typography, and global element styles.
 * This file MUST be loaded after variables.css and before all other stylesheets.
 *
 * Provides:
 *  - Universal box-sizing reset
 *  - Base body/typography styles
 *  - Focus-visible defaults for accessibility
 *  - Reduced-motion support
 */

/* ===== UNIVERSAL RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== BASE BODY ===== */
body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    transition: background-color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.75rem; color: var(--primary-color); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ===== DARK MODE BASE ADJUSTMENTS ===== */
[data-theme="dark"] a:not(.btn) {
    color: var(--primary-color);
}

[data-theme="dark"] .fas {
    color: inherit;
}

/* Keep nav-brand icon primary color in dark mode */
[data-theme="dark"] .nav-brand i.fas {
    color: var(--primary-color);
}

/* Dark mode input styling */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color: var(--text-color);
    background-color: var(--bg-dark);
}

/* Fix dropdown option text in dark mode */
[data-theme="dark"] select option {
    background-color: var(--bg-dark);
    color: var(--text-color);
}

/* Dark mode date/time picker icons */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="week"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.4);
    opacity: 1;
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"] {
    color-scheme: dark;
}

/* ===== ACCESSIBILITY: FOCUS VISIBLE ===== */
/* Provide visible focus ring for keyboard users */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Interactive elements get specific focus styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ===== ACCESSIBILITY: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.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;
}

/* Text utilities */
.text-large { font-size: 1.125rem; line-height: 1.7; }
.text-small { font-size: 0.875rem; line-height: 1.5; }
.text-xs { font-size: 0.75rem; line-height: 1.4; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }
.text-light { color: var(--text-light); }
.text-muted { color: var(--text-color-muted); opacity: 0.7; }
.text-bold { font-weight: 700; }
.text-medium { font-weight: 500; }
.text-normal { font-weight: 400; }
.text-light-weight { font-weight: 300; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.text-capitalize { text-transform: capitalize; }
.text-spaced { letter-spacing: 0.05em; }
.text-tight { letter-spacing: -0.01em; }

/* Link utilities */
.link-subtle {
    color: var(--text-light);
    text-decoration: none;
}
.link-subtle:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.link-button {
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}
.link-button > * + * {
    margin-left: 0.5rem;
}
.link-button i { font-size: 0.9em; }

/* Block elements */
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
    color: var(--text-light);
}

code {
    font-family: monospace;
    background-color: var(--bg-dark);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.highlight {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* Prevent background scroll when a modal is open */
body.modal-open,
body.no-scroll {
    overflow: hidden;
    overscroll-behavior: contain;
}
html.modal-open,
html.no-scroll {
    overflow: hidden;
    height: 100%;
}

/* ===== SHARED ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

@keyframes zoom {
    from { transform: scale(0.1); }
    to { transform: scale(1); }
}
