/* CopyrightChains Shared Theme
   Common styles used by Admin Dashboard, Creator Portal, and all pages
   Version: 9.5
   Last Updated: 2026-01-04 03:45:00 UTC */

/* ============================================
   BASE COLOR PALETTE
   ============================================ */
:root {
    /* Brand Colors */
    --nim-primary: #0674bb;
    --nim-primary-light: #0891d4;
    --nim-primary-dark: #055a94;
    --nim-primary-muted: rgba(6, 116, 187, 0.15);

    /* Grey Scale */
    --grey-50: #fafafa;
    --grey-100: #f4f4f5;
    --grey-200: #e4e4e7;
    --grey-300: #d4d4d8;
    --grey-400: #a1a1aa;
    --grey-500: #71717a;
    --grey-600: #52525b;
    --grey-700: #3f3f46;
    --grey-800: #27272a;
    --grey-850: #1f1f23;
    --grey-900: #18181b;
    --grey-950: #0f0f11;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Typography */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Responsive Breakpoints */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;

    /* Semantic Colors - Dark Theme (Default) */
    --bg-primary: var(--grey-950);
    --bg-secondary: var(--grey-900);
    --bg-tertiary: var(--grey-850);
    --bg-elevated: var(--grey-800);
    --text-primary: var(--grey-100);
    --text-secondary: var(--grey-300);
    --text-muted: var(--grey-500);
    --border-primary: var(--grey-800);
    --border-secondary: var(--grey-700);
    --scrollbar-track: var(--grey-900);
    --scrollbar-thumb: var(--grey-700);
}

/* ============================================
   LIGHT THEME
   ============================================ */
[data-theme="light"] {
    --bg-primary: var(--grey-50);
    --bg-secondary: #ffffff;
    --bg-tertiary: var(--grey-100);
    --bg-elevated: #ffffff;
    --text-primary: var(--grey-900);
    --text-secondary: var(--grey-700);
    --text-muted: var(--grey-500);
    --border-primary: var(--grey-200);
    --border-secondary: var(--grey-300);
    --scrollbar-track: var(--grey-100);
    --scrollbar-thumb: var(--grey-400);
}

/* Light theme specific overrides */
[data-theme="light"] .card {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

[data-theme="light"] .btn-secondary:hover {
    background: var(--grey-200);
    border-color: var(--grey-400);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

[data-theme="light"] .modal-content {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

[data-theme="light"] ::selection {
    background: rgba(6, 116, 187, 0.3);
    color: var(--grey-900);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Selection & Scrollbar */
::selection { background: rgba(6, 116, 187, 0.4); color: white; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-600); }

/* Icon System */
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* Cards */
.card { background: var(--grey-900); border: 1px solid var(--grey-800); border-radius: 12px; padding: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--grey-100);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-title .icon { color: var(--nim-primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--nim-primary) 0%, var(--nim-primary-light) 100%); color: white; }
.btn-primary:hover { box-shadow: 0 0 20px rgba(6, 116, 187, 0.3); filter: brightness(1.1); }
.btn-secondary { background: var(--grey-850); color: var(--grey-100); border: 1px solid var(--grey-700); }
.btn-secondary:hover { background: var(--grey-800); border-color: var(--grey-600); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.type-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.type-badge.musical-work { background: var(--nim-primary-muted); color: var(--nim-primary-light); }
.type-badge.recording { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.type-badge.orphan { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.status-badge.confirmed, .status-badge.verified, .status-badge.completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-badge.pending, .status-badge.processing { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--error); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--grey-300);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-label .required { color: var(--error); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--grey-850);
    border: 1px solid var(--grey-700);
    border-radius: 6px;
    color: var(--grey-100);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--nim-primary);
    box-shadow: 0 0 0 3px var(--nim-primary-muted);
}
.form-input::placeholder { color: var(--grey-600); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--grey-500); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: var(--error); font-size: 12px; margin-top: 4px; }

/* File Upload */
.file-upload {
    border: 2px dashed var(--grey-700);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.file-upload:hover { border-color: var(--nim-primary); background: var(--nim-primary-muted); }
.file-upload.has-file { border-color: var(--success); border-style: solid; }
.file-upload.dragover { border-color: var(--nim-primary); background: var(--nim-primary-muted); }
.file-upload-icon { color: var(--grey-500); margin-bottom: 8px; }
.file-upload-text { font-size: 13px; color: var(--grey-400); }
.file-upload-text strong { color: var(--nim-primary-light); }
.file-upload-hint { font-size: 11px; color: var(--grey-600); margin-top: 4px; }
.file-upload input[type="file"] { display: none; }
.file-info { margin-top: 12px; padding: 10px; background: var(--grey-850); border-radius: 6px; text-align: left; }
.file-info-name { font-size: 13px; color: var(--grey-100); margin-bottom: 4px; }
.file-info-hash { font-family: var(--font-mono); font-size: 11px; color: var(--success); word-break: break-all; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--grey-900);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--grey-800);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--grey-800);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--grey-400);
    transition: all 0.2s;
    z-index: 10;
}
.modal-close:hover { background: var(--grey-700); color: var(--grey-100); }
.modal-body { padding: 24px; }

/* Spinner */
.spinner { width: 14px; height: 14px; border: 2px solid var(--grey-700); border-top-color: var(--nim-primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-lg { width: 24px; height: 24px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hash Links */
.hash-link { color: var(--nim-primary); text-decoration: none; font-family: var(--font-mono); font-size: 12px; }
.hash-link:hover { text-decoration: underline; color: var(--nim-primary-light); }

/* Empty State */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--grey-600); }
.empty-state-title { font-family: var(--font-display); font-size: 16px; color: var(--grey-400); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; color: var(--grey-500); }

/* Utility Classes */
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--grey-500); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Skip Link - Hidden until focused */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--nim-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--nim-primary-light);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Visible - Enhanced focus indicators */
:focus-visible {
    outline: 2px solid var(--nim-primary);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Button focus states */
.btn:focus-visible {
    outline: 2px solid var(--nim-primary-light);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--nim-primary-muted);
}

/* Form focus states (enhanced) */
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
    outline: none;
    border-color: var(--nim-primary);
    box-shadow: 0 0 0 3px var(--nim-primary-muted);
}

/* Link focus states */
a:focus-visible {
    outline: 2px solid var(--nim-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   THEME TOGGLE COMPONENT
   ============================================ */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--nim-primary);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--nim-primary);
    outline-offset: 2px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 20px;
    height: 20px;
}

/* Show/hide icons based on theme */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ============================================
   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;
    }
}
