/* StudyFRCEM - Custom Styles */
/* Matching React version exactly */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   CSS Variables (matching React index.css)
   ======================================== */
:root {
    --background: 210 33% 98%;
    --foreground: 0 0% 10%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 10%;
    --primary: 214 84% 42%;
    --primary-foreground: 0 0% 100%;
    --secondary: 216 75% 22%;
    --secondary-foreground: 0 0% 100%;
    --muted: 210 33% 96%;
    --muted-foreground: 0 0% 40%;
    --accent: 203 89% 59%;
    --accent-foreground: 0 0% 100%;
    --success: 158 61% 49%;
    --success-foreground: 0 0% 100%;
    --destructive: 355 77% 56%;
    --destructive-foreground: 0 0% 100%;
    --border: 210 20% 90%;
    --input: 210 20% 90%;
    --ring: 214 84% 42%;
    --radius: 0.75rem;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* ========================================
   Typography (matching React h1-h6)
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

h5 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
}

h6 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

/* Responsive typography */
@media (min-width: 768px) {
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 1.75rem; }
}

@media (min-width: 1024px) {
    h1 { font-size: 3.5rem; }
    h2 { font-size: 2.75rem; }
}

/* ========================================
   Buttons (matching React button styles)
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.9);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--muted));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--muted));
}

/* Button sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

/* ========================================
   Cards (matching React card styles)
   ======================================== */
.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.card-content {
    padding: 1.5rem;
}

/* ========================================
   Form Inputs
   ======================================== */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.form-input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* ========================================
   Toggle Switch
   ======================================== */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: hsl(var(--muted));
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    padding: 0;
}

.toggle.active {
    background-color: hsl(var(--primary));
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle.active .toggle-thumb {
    transform: translateX(20px);
}

/* ========================================
   Accordion / FAQ
   ======================================== */
.accordion-item {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-item:hover {
    border-color: hsl(var(--primary) / 0.3);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.accordion-item.open {
    border-color: hsl(var(--primary) / 0.5);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.accordion-trigger {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    color: hsl(var(--foreground));
    transition: color 0.2s ease;
}

.accordion-trigger:hover,
.accordion-item.open .accordion-trigger {
    color: hsl(var(--primary));
}

.accordion-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(var(--primary) / 0.1);
    border-radius: 9999px;
    margin-top: 0.125rem;
    transition: background-color 0.2s ease;
}

.accordion-trigger:hover .accordion-icon,
.accordion-item.open .accordion-icon {
    background-color: hsl(var(--primary) / 0.2);
}

.accordion-icon svg {
    width: 0.875rem;
    height: 0.875rem;
    color: hsl(var(--primary));
}

.accordion-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.accordion-item.open .accordion-chevron {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.open .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 1.25rem 1.25rem 3.5rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    line-height: 1.7;
}

/* ========================================
   Range Slider
   ======================================== */
.range-slider {
    position: relative;
    height: 8px;
    background-color: hsl(var(--muted));
    border-radius: 4px;
}

.range-slider-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: hsl(var(--primary));
    border-radius: 4px;
    pointer-events: none;
}

.range-slider-thumb {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-color: hsl(var(--primary));
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.range-slider input[type="range"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ========================================
   Category Select Dropdown
   ======================================== */
.category-select-toggle {
    cursor: pointer;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.category-badge button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.category-badge button:hover {
    opacity: 1;
}

/* ========================================
   Dashboard Sidebar
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .sidebar {
        position: relative;
        transform: translateX(0);
    }
}

.overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Mobile Menu
   ======================================== */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    padding: 0 !important;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-menu.open {
    max-height: 500px;
    padding: 1rem 0 !important;
}

/* ========================================
   Badge / Pill
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
}

/* ========================================
   Scrollbar
   ======================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--primary)) hsl(var(--muted));
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: hsl(var(--muted));
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background: hsl(var(--primary));
    border-radius: 10px;
    border: 2px solid hsl(var(--muted));
}

*::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary) / 0.8);
}

/* ========================================
   Utility Classes
   ======================================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container { 
        padding-left: 1.5rem; 
        padding-right: 1.5rem; 
    }
}

@media (min-width: 1024px) {
    .container { 
        padding-left: 2rem; 
        padding-right: 2rem; 
    }
}

.text-balance {
    text-wrap: balance;
}

/* ========================================
   Skeleton Loading States
   ======================================== */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsl(var(--muted-foreground) / 0.08) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    transform: translateX(-100%);
}

@keyframes skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Skeleton Text Variants */
.skeleton-text {
    height: 1rem;
    width: 100%;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 80%;
}

.skeleton-text-lg {
    height: 1.5rem;
    width: 60%;
}

.skeleton-text-xl {
    height: 2rem;
    width: 50%;
}

/* Skeleton Shape Variants */
.skeleton-circle {
    border-radius: 9999px;
}

.skeleton-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.skeleton-avatar-lg {
    width: 3rem;
    height: 3rem;
}

.skeleton-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
}

.skeleton-icon-lg {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
}

/* Skeleton Button */
.skeleton-button {
    height: 2.5rem;
    width: 8rem;
    border-radius: var(--radius);
}

.skeleton-button-lg {
    height: 3rem;
    width: 10rem;
}

/* Skeleton Card */
.skeleton-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

/* Skeleton Chart */
.skeleton-chart {
    height: 16rem;
    border-radius: var(--radius);
}

/* Skeleton Table Row */
.skeleton-table-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid hsl(var(--border));
}

/* Skeleton Badge */
.skeleton-badge {
    height: 1.5rem;
    width: 4rem;
    border-radius: 9999px;
}

/* Width Utilities for Skeleton */
.skeleton-w-full { width: 100%; }
.skeleton-w-3\/4 { width: 75%; }
.skeleton-w-2\/3 { width: 66.666667%; }
.skeleton-w-1\/2 { width: 50%; }
.skeleton-w-1\/3 { width: 33.333333%; }
.skeleton-w-1\/4 { width: 25%; }

/* Skeleton wrapper for fading in content */
.skeleton-wrapper {
    transition: opacity 0.3s ease-in-out;
}

.skeleton-wrapper.loaded .skeleton-content {
    display: none;
}

.skeleton-wrapper:not(.loaded) .actual-content {
    display: none;
}

/* Stat Card Skeleton */
.skeleton-stat-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
}

.skeleton-stat-card .skeleton-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.skeleton-stat-card .skeleton-stat-value {
    height: 2rem;
    width: 3rem;
    margin-bottom: 0.5rem;
}

.skeleton-stat-card .skeleton-stat-label {
    height: 0.875rem;
    width: 6rem;
}

/* Progress Bar Skeleton */
.skeleton-progress {
    height: 0.5rem;
    width: 100%;
    border-radius: 9999px;
}

/* List Item Skeleton */
.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.skeleton-list-item:last-child {
    border-bottom: none;
}

/* Form Field Skeleton */
.skeleton-input {
    height: 2.75rem;
    width: 100%;
    border-radius: var(--radius);
}

.skeleton-label {
    height: 0.875rem;
    width: 6rem;
    margin-bottom: 0.5rem;
}

/* Pulse animation alternative */
.skeleton-pulse {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
