/* CaseStories Custom Styles
 * Complements Tailwind CSS CDN
 * Font: Inter (Google Fonts)
 */

/* Hide Alpine.js x-cloak elements until the framework initialises */
[x-cloak] { display: none !important; }

/* === BASE === */
:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-primary-light: #818cf8;
    --color-secondary: #64748b;
    --color-accent: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --border-radius: 0.5rem;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-elevated: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --transition: 150ms ease-in-out;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    color: #1e293b;
    background-color: #f8fafc;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
}

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

a:hover {
    color: var(--color-primary-dark);
}

/* === PROSE STYLES (case study content) === */
.prose {
    max-width: 72ch;
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #334155;
}

.prose h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.prose h2 {
    font-size: 1.625rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    color: #0f172a;
    letter-spacing: -0.015em;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.prose h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.prose p {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.prose ul,
.prose ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-bottom: 0.375rem;
}

.prose li::marker {
    color: var(--color-primary);
}

.prose blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--color-primary);
    background: #f1f5f9;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    color: #475569;
}

.prose blockquote p {
    margin-bottom: 0;
}

.prose code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875em;
    background: #f1f5f9;
    color: var(--color-primary-dark);
    padding: 0.125em 0.375em;
    border-radius: 0.25rem;
    border: 1px solid #e2e8f0;
}

.prose pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.7;
}

.prose pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-elevated);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
}

.prose th {
    background: #f1f5f9;
    font-weight: 600;
    padding: 0.625rem 1rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    color: #0f172a;
}

.prose td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.prose tr:hover td {
    background: #f8fafc;
}

.prose hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 2.5rem 0;
}

.prose a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.prose a:hover {
    color: var(--color-primary-dark);
}

.prose strong {
    font-weight: 700;
    color: #0f172a;
}

/* === NAVIGATION === */
.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #475569;
    border-radius: 0.375rem;
    transition: color var(--transition), background-color var(--transition);
}

.nav-link:hover {
    color: var(--color-primary);
    background-color: #ede9fe;
}

.nav-link.active {
    color: var(--color-primary);
    background-color: #ede9fe;
}

.nav-logo {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-primary);
    transition: opacity var(--transition);
}

.nav-logo:hover {
    opacity: 0.85;
    color: var(--color-primary);
}

/* Mobile nav */
.mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
}

.mobile-menu.open {
    display: block;
}

.mobile-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 100vw);
    height: 100%;
    background: #fff;
    padding: 1.5rem;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 300ms ease;
}

.mobile-menu.open .mobile-menu-panel {
    transform: translateX(0);
}

/* === CARD STYLES === */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid #e2e8f0;
}

.card:hover {
    box-shadow: var(--shadow-elevated);
    transform: translateY(-2px);
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 1.25rem 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}

.card-meta {
    font-size: 0.8125rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Featured case card */
.case-card {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid #e2e8f0;
    transition: box-shadow 200ms ease, transform 200ms ease;
    display: flex;
    flex-direction: column;
}

.case-card:hover {
    box-shadow: 0 8px 25px -5px rgba(99,102,241,0.15), 0 4px 10px -5px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.case-card-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}

.case-card:hover .case-card-cover {
    transform: scale(1.03);
}

.case-card-cover-wrap {
    overflow: hidden;
}

.case-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* === BUTTON STYLES === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    user-select: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: #64748b;
    border-color: transparent;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-sm {
    padding: 0.3125rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.0625rem;
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    inset: 50% auto auto 50%;
    width: 1em;
    height: 1em;
    margin: -0.5em 0 0 -0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 600ms linear infinite;
    color: #fff;
}

/* === FORM STYLES === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 0.25rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5625rem 0.875rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: #1e293b;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control.is-invalid {
    border-color: var(--color-danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}

.form-control.is-valid {
    border-color: var(--color-accent);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.form-error {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
}

.form-hint {
    display: block;
    font-size: 0.8125rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

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

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1.25rem;
    padding-right: 2.25rem;
}

.char-counter {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.near-limit {
    color: var(--color-warning);
}

.char-counter.at-limit {
    color: var(--color-danger);
}

/* Tag input */
.tag-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    cursor: text;
    min-height: 2.625rem;
    align-items: center;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tag-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.tag-input-wrapper input {
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: #1e293b;
    flex: 1;
    min-width: 120px;
    padding: 0.125rem 0.25rem;
    background: transparent;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5rem;
    background: #ede9fe;
    color: var(--color-primary-dark);
    border-radius: 99px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
}

.tag-badge button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    border-radius: 50%;
    transition: background var(--transition), color var(--transition);
}

.tag-badge button:hover {
    background: var(--color-primary-light);
    color: #fff;
}

/* === BADGE STYLES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.625rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

.badge-primary {
    background: #ede9fe;
    color: var(--color-primary-dark);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-outline {
    background: transparent;
    border: 1px solid currentColor;
}

/* === LIGHTBOX === */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 200ms ease forwards;
    padding: 1rem;
}

.lightbox-content {
    position: relative;
    max-width: min(90vw, 1200px);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.375rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    animation: slideUp 200ms ease forwards;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    transition: background var(--transition);
    font-size: 1.25rem;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10000;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    transition: background var(--transition);
    font-size: 1.25rem;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-caption {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    text-align: center;
    max-width: 60ch;
    pointer-events: none;
}

.lightbox-counter {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
}

/* === BEFORE/AFTER SLIDER === */
.before-after-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    user-select: none;
    cursor: col-resize;
    box-shadow: var(--shadow-elevated);
}

.before-after-container img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.before-after-before {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.before-after-before img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    max-width: none;
}

.before-after-label {
    position: absolute;
    top: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 99px;
    pointer-events: none;
}

.before-after-label-before { left: 0.75rem; }
.before-after-label-after { right: 0.75rem; }

.before-after-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #fff;
    transform: translateX(-50%);
    cursor: col-resize;
    z-index: 2;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

.before-after-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2.5rem;
    height: 2.5rem;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.before-after-handle::after {
    content: '◀ ▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: #64748b;
    letter-spacing: -1px;
    pointer-events: none;
}

/* === WIZARD STYLES === */
.wizard-progress {
    display: flex;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 0;
}

.wizard-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.wizard-step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1.125rem;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
    transition: background 300ms ease;
}

.wizard-step-item.completed:not(:last-child)::after {
    background: var(--color-primary);
}

.wizard-step-circle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #94a3b8;
    transition: all 300ms ease;
}

.wizard-step-item.active .wizard-step-circle {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
}

.wizard-step-item.completed .wizard-step-circle {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.wizard-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 0.375rem;
    white-space: nowrap;
    text-align: center;
    transition: color 300ms ease;
}

.wizard-step-item.active .wizard-step-label,
.wizard-step-item.completed .wizard-step-label {
    color: var(--color-primary);
}

.wizard-step-panel {
    display: none;
    animation: fadeIn 250ms ease;
}

.wizard-step-panel.active {
    display: block;
}

/* Layout selection cards */
.layout-card {
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    text-align: center;
    background: #fff;
}

.layout-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.layout-card.selected {
    border-color: var(--color-primary);
    background: #faf5ff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.layout-card .layout-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.layout-card .layout-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.layout-card .layout-desc {
    font-size: 0.8125rem;
    color: #64748b;
}

/* Media upload zone */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    background: #f8fafc;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: #ede9fe;
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-zone .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

.upload-progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 200ms ease;
    width: 0%;
}

.media-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.media-thumb {
    position: relative;
    border-radius: 0.375rem;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f1f5f9;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}

.media-thumb:active {
    cursor: grabbing;
}

.media-thumb.dragging {
    opacity: 0.5;
    border-color: var(--color-primary);
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-thumb-delete {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.media-thumb:hover .media-thumb-delete {
    opacity: 1;
}

/* AI generation */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 3rem 1.5rem;
}

.ai-loading-dots {
    display: flex;
    gap: 0.5rem;
}

.ai-loading-dots span {
    width: 0.625rem;
    height: 0.625rem;
    background: var(--color-primary);
    border-radius: 50%;
    animation: dotPulse 1.2s ease-in-out infinite;
}

.ai-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.ai-status-text {
    font-size: 1rem;
    color: #64748b;
    font-style: italic;
    min-height: 1.5rem;
    transition: opacity 400ms ease;
}

/* === DASHBOARD SIDEBAR === */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: width 300ms ease, transform 300ms ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6875rem 1rem;
    color: #475569;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sidebar-nav-item.active {
    background: #ede9fe;
    color: var(--color-primary);
}

.sidebar-nav-item .nav-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.7;
}

.sidebar-nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-nav-label {
    transition: opacity 200ms ease;
}

.sidebar.collapsed .sidebar-nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* === STATS / CHART AREA === */
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-change {
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.1875rem;
}

.stat-change.up { color: var(--color-accent); }
.stat-change.down { color: var(--color-danger); }

.chart-wrapper {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    overflow: hidden;
}

.chart-wrapper canvas {
    display: block;
    max-width: 100%;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    pointer-events: none;
    max-width: min(400px, calc(100vw - 2.5rem));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    pointer-events: all;
    animation: slideInRight 250ms ease forwards;
    max-width: 100%;
    border-left: 4px solid #e2e8f0;
}

.toast.toast-success { border-left-color: var(--color-accent); }
.toast.toast-error   { border-left-color: var(--color-danger); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-info    { border-left-color: var(--color-primary); }

.toast-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
    margin-top: 0.0625rem;
}

.toast-success .toast-icon { color: var(--color-accent); }
.toast-error   .toast-icon { color: var(--color-danger); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info    .toast-icon { color: var(--color-primary); }

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-message {
    font-size: 0.9375rem;
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}

.toast-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition);
}

.toast-dismiss:hover { color: #475569; }

.toast.toast-hiding {
    animation: slideOutRight 200ms ease forwards;
}

/* === LOADING SKELETONS === */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 0.25rem;
}

.skeleton-text {
    height: 1em;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.skeleton-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.skeleton-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.skeleton-card-body {
    padding: 1.25rem;
}

/* === LANGUAGE SELECTOR === */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    user-select: none;
}

.lang-dropdown-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-elevated);
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 150ms ease;
}

.lang-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background var(--transition);
}

.lang-dropdown-menu a:hover {
    background: #f1f5f9;
}

.lang-dropdown-menu a.active {
    background: #ede9fe;
    color: var(--color-primary);
    font-weight: 500;
}

.lang-flag {
    font-size: 1rem;
    line-height: 1;
}

/* === COOKIE BANNER === */
.cookie-banner {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    width: min(600px, calc(100vw - 2rem));
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: slideUp 300ms ease;
}

.cookie-banner-text {
    font-size: 0.875rem;
    line-height: 1.5;
    flex: 1;
}

.cookie-banner-text a {
    color: var(--color-primary-light);
}

.cookie-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* === ADMIN STYLES === */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.admin-table th {
    background: #f8fafc;
    padding: 0.6875rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.admin-table th:hover {
    background: #f1f5f9;
}

.admin-table th.sort-asc::after { content: ' ↑'; color: var(--color-primary); }
.admin-table th.sort-desc::after { content: ' ↓'; color: var(--color-primary); }

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #fafbff;
}

.admin-table tr.expanded td {
    background: #f8fafc;
}

.admin-table .row-actions {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.admin-table tr:hover .row-actions {
    opacity: 1;
}

/* Inline confirm modal */
.inline-confirm {
    display: none;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: #fff3f3;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    animation: fadeIn 150ms ease;
}

.inline-confirm.visible {
    display: flex;
}

/* Flash messages */
.flash-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    animation: slideDown 300ms ease;
    border: 1px solid transparent;
}

.flash-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.flash-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.flash-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.flash-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* === RESPONSIVE UTILITIES === */
.container-prose {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-wide {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.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;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .sidebar { display: none; }
    .sidebar.mobile-open { display: flex; position: fixed; inset: 0; z-index: 50; width: 80vw; max-width: 300px; }
    #toast-container { top: auto; bottom: 1rem; right: 0.75rem; left: 0.75rem; max-width: 100%; }
    .wizard-step-label { display: none; }
    .cookie-banner { flex-direction: column; text-align: center; }
    .cookie-banner-actions { justify-content: center; }
    .lightbox-nav { display: none; }
}

@media (min-width: 769px) {
    .show-mobile-only { display: none !important; }
}

/* === PRINT STYLES === */
@media print {
    nav,
    footer,
    .sidebar,
    .btn,
    .cookie-banner,
    #toast-container,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        font-size: 12pt;
        color: #000;
    }

    .prose {
        max-width: 100%;
    }

    .prose a {
        color: #000;
        text-decoration: underline;
    }

    .prose a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #555;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        page-break-inside: avoid;
        max-width: 100% !important;
    }

    .before-after-container {
        page-break-inside: avoid;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(24px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

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

.animate-fade-in  { animation: fadeIn 300ms ease forwards; }
.animate-slide-up { animation: slideUp 300ms ease forwards; }
.animate-spin     { animation: spin 600ms linear infinite; }
.animate-pulse    { animation: pulse 2s ease-in-out infinite; }
.animate-shimmer  { animation: shimmer 1.4s infinite; }
