/* ========================================
   LearnStack - Professional UI Stylesheet
   Clean, Modern Design
   ======================================== */

/* Global Styles & Typography */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0f172a;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --text-primary: var(--mud-palette-text-primary, #0f172a);
    --text-secondary: var(--mud-palette-text-secondary, #475569);
    --text-disabled: #94a3b8;
    --divider: var(--mud-palette-lines-default, #e2e8f0);
    --background: var(--mud-palette-background, #f8fafc);
    --surface: var(--mud-palette-surface, #ffffff);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--background);
    color: var(--text-primary);
}

/* Focus States */
h1:focus {
    outline: none;
}

/* Form Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
    border-color: var(--success);
}

.invalid {
    outline: 1px solid var(--error);
    border-color: var(--error);
}

.validation-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Error Boundary */
.blazor-error-boundary {
    background: var(--error);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--border-radius-sm);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Form Controls */
.darker-border-checkbox.form-check-input {
    border-color: var(--text-secondary);
}

.form-floating > .form-control-plaintext::placeholder, 
.form-floating > .form-control::placeholder {
    color: var(--text-disabled);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, 
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ========================================
   Card Components
   ======================================== */

.resource-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--divider);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.resource-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--divider);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--divider);
    box-shadow: var(--card-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
}

.stat-card .stat-content {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   Navigation & Header
   ======================================== */

.app-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--divider);
}

.brand-logo {
    font-weight: 600;
    color: var(--primary);
}

/* ========================================
   Buttons & Interactive Elements
   ======================================== */

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: background var(--transition-normal);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* ========================================
   Chips & Tags
   ======================================== */

.chip-status-idea {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    font-weight: 500;
}

.chip-status-progress {
    background: #fff3e0 !important;
    color: #e65100 !important;
    font-weight: 500;
}

.chip-status-complete {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    font-weight: 500;
}

.chip-priority-high {
    background: #ffebee !important;
    color: #c62828 !important;
    font-weight: 500;
}

.chip-priority-medium {
    background: #fff3e0 !important;
    color: #e65100 !important;
    font-weight: 500;
}

.chip-priority-low {
    background: rgba(0, 0, 0, 0.08) !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
}

html.dark .chip-status-idea {
    background: rgba(21, 101, 192, 0.25) !important;
    color: #90caf9 !important;
}

html.dark .chip-status-progress {
    background: rgba(230, 81, 0, 0.25) !important;
    color: #ffb74d !important;
}

html.dark .chip-status-complete {
    background: rgba(46, 125, 50, 0.25) !important;
    color: #81c784 !important;
}

html.dark .chip-priority-high {
    background: rgba(198, 40, 40, 0.25) !important;
    color: #ef9a9a !important;
}

html.dark .chip-priority-medium {
    background: rgba(230, 81, 0, 0.25) !important;
    color: #ffb74d !important;
}

html.dark .chip-priority-low {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
}

/* Content type chips */
.chip-type-video {
    background: #ffebee !important;
    color: #c62828 !important;
    font-weight: 500;
}

.chip-type-article {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    font-weight: 500;
}

.chip-type-course {
    background: #fff3e0 !important;
    color: #e65100 !important;
    font-weight: 500;
}

.chip-type-podcast {
    background: #f3e8ff !important;
    color: #7b1fa2 !important;
    font-weight: 500;
}

.chip-type-documentation {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    font-weight: 500;
}

.chip-type-default {
    background: #f5f5f5 !important;
    color: #616161 !important;
    font-weight: 500;
}

html.dark .chip-type-video {
    background: rgba(198, 40, 40, 0.25) !important;
    color: #ef9a9a !important;
}

html.dark .chip-type-article {
    background: rgba(21, 101, 192, 0.25) !important;
    color: #90caf9 !important;
}

html.dark .chip-type-course {
    background: rgba(230, 81, 0, 0.25) !important;
    color: #ffb74d !important;
}

html.dark .chip-type-podcast {
    background: rgba(123, 31, 162, 0.25) !important;
    color: #ce93d8 !important;
}

html.dark .chip-type-documentation {
    background: rgba(46, 125, 50, 0.25) !important;
    color: #81c784 !important;
}

html.dark .chip-type-default {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
}

/* Content idea type chips */
.chip-idea-blogpost {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    font-weight: 500;
}

.chip-idea-video {
    background: #ffebee !important;
    color: #c62828 !important;
    font-weight: 500;
}

.chip-idea-tweetthread {
    background: #f3e8ff !important;
    color: #7b1fa2 !important;
    font-weight: 500;
}

.chip-idea-tutorial {
    background: #fff3e0 !important;
    color: #e65100 !important;
    font-weight: 500;
}

.chip-idea-other {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    font-weight: 500;
}

html.dark .chip-idea-blogpost {
    background: rgba(21, 101, 192, 0.25) !important;
    color: #90caf9 !important;
}

html.dark .chip-idea-video {
    background: rgba(198, 40, 40, 0.25) !important;
    color: #ef9a9a !important;
}

html.dark .chip-idea-tweetthread {
    background: rgba(123, 31, 162, 0.25) !important;
    color: #ce93d8 !important;
}

html.dark .chip-idea-tutorial {
    background: rgba(230, 81, 0, 0.25) !important;
    color: #ffb74d !important;
}

html.dark .chip-idea-other {
    background: rgba(46, 125, 50, 0.25) !important;
    color: #81c784 !important;
}

/* ========================================
   Thumbnail Styles
   ======================================== */

.thumbnail-container {
    position: relative;
    width: 120px;
    height: 80px;
    min-width: 120px;
    min-height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--surface);
}

.thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
}

/* ========================================
   Filter & Search Section
   ======================================== */

.filter-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--divider);
    padding: 16px;
    margin-bottom: 20px;
}

/* ========================================
   Page Headers
   ======================================== */

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-weight: 600;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ========================================
   Empty States
   ======================================== */

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--divider);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}

/* ========================================
   Drag & Drop
   ======================================== */

.draggable-item {
    cursor: grab;
}

.draggable-item:active {
    cursor: grabbing;
}

.drag-handle {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.resource-card:hover .drag-handle {
    opacity: 0.8;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.25s ease-out;
}

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

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--divider);
    border-radius: 4px;
}

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

/* ========================================
   MudBlazor Overrides
   ======================================== */

.mud-chip {
    font-weight: 500;
}

.mud-button {
    text-transform: none !important;
    font-weight: 500;
}

.mud-paper {
    border-radius: var(--border-radius) !important;
}

.mud-dialog .mud-dialog-content {
    padding: 1.5rem;
}

.mud-table-cell {
    font-size: 0.875rem;
}

/* Pagination */
.mud-pagination .mud-pagination-item.mud-pagination-item-selected {
    background: var(--primary);
    color: white;
}

/* Tabs */
.mud-tabs .mud-tab.mud-tab-active {
    font-weight: 600;
}

/* ========================================
   Dark Mode Overrides
   ======================================== */

html.dark .stat-card .stat-icon,
html.dark .empty-state-icon {
    background: rgba(255, 255, 255, 0.08);
}