/**
 * Base Styles
 * Foundation styles for all shared components
 */

/* ============================================
   CSS Reset & Normalization
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ============================================
   Base Typography
   ============================================ */

.component-root {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Link Styles
   ============================================ */

.component-link {
    color: var(--color-blue-400);
    text-decoration: none;
    transition: var(--transition-colors);
}

.component-link:hover {
    color: var(--color-blue-300);
    text-decoration: underline;
}

.component-link:focus {
    outline: 2px solid var(--color-blue-500);
    outline-offset: 2px;
}

/* ============================================
   Focus States (Accessibility)
   ============================================ */

.component-focusable:focus {
    outline: 2px solid var(--color-blue-500);
    outline-offset: 2px;
}

.component-focusable:focus:not(:focus-visible) {
    outline: none;
}

.component-focusable:focus-visible {
    outline: 2px solid var(--color-blue-500);
    outline-offset: 2px;
}

/* ============================================
   Selection Colors
   ============================================ */

.component-root ::selection {
    background-color: var(--color-blue-500);
    color: var(--color-text-primary);
}

.component-root ::-moz-selection {
    background-color: var(--color-blue-500);
    color: var(--color-text-primary);
}

/* ============================================
   Disabled State
   ============================================ */

.component-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   Loading State
   ============================================ */

.component-loading {
    position: relative;
    pointer-events: none;
}

.component-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    margin-left: -0.5rem;
    border: 2px solid var(--color-text-primary);
    border-top-color: transparent;
    border-radius: var(--radius-full);
    animation: component-spin 0.6s linear infinite;
}

@keyframes component-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

.component-scrollable::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.component-scrollable::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.component-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
}

.component-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Animation Utilities
   ============================================ */

@keyframes component-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes component-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes component-slide-up {
    from {
        transform: translateY(1rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes component-slide-down {
    from {
        transform: translateY(-1rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes component-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Prefers Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .component-root * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
