/**
 * StudioDance - Global Styles
 * Spotify-inspired dark theme
 */

/* ========================================
   1. Theme Variables (Spotify-inspired)
   ======================================== */
:root {
    /* Core Colors */
    --bg-base: #121212;
    --bg-elevated: #181818;
    --bg-highlight: #282828;
    --bg-press: #333333;

    /* Background Tint - Uses secondary color */
    --bg-tint: rgba(30, 58, 95, 0.15);

    /* Accent Colors - Dark Maroon & Navy (Instructor mode default) */
    --color-maroon: #722F37;
    --color-maroon-hover: #8B4450;
    --color-navy: #1E3A5F;
    --color-navy-hover: #2E5580;

    /* Primary/Secondary swap based on mode */
    --accent-primary: var(--color-maroon);
    --accent-primary-hover: var(--color-maroon-hover);
    --accent-secondary: var(--color-navy);
    --accent-secondary-hover: var(--color-navy-hover);
    --accent-purple: #5C4D6D;
    --accent-teal: #3D5A6F;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #727272;

    /* Functional Colors */
    --color-danger: #e91429;
    --color-warning: #ffa42b;
    --color-success: var(--color-maroon);

    /* Borders & Dividers */
    --border-color: #333333;
    --divider-color: #292929;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;

    /* Brand Accent (aligned with iOS Theme.Colors.accent) */
    --color-accent: #5438b7;
    --color-accent-light: #7a61d9;

    /* Functional */
    --color-success-green: #4caf50;

    /* Spacing scale (aligned with iOS Theme.Spacing) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-xxl: 24px;
    --spacing-xxxl: 32px;

    /* Sizing */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 500px;

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Overlays */
    --overlay-heavy: rgba(0, 0, 0, 0.8);
    --overlay-medium: rgba(0, 0, 0, 0.5);
    --overlay-light: rgba(0, 0, 0, 0.3);

    /* Legacy variable mappings for compatibility */
    --dark-bg: var(--bg-base);
    --panel-bg: var(--bg-elevated);
    --text-main: var(--text-primary);
    --text-dim: var(--text-secondary);
    --accent-a: var(--accent-primary);
    --accent-b: var(--accent-teal);
    --danger: var(--color-danger);
    --master: var(--color-warning);
    --active-bg: var(--bg-highlight);
    --active-border: var(--text-primary);
    --label-bg: rgba(0, 0, 0, 0.7);
    --label-text: var(--text-primary);
}

/* Student Mode - Swap primary (navy) and secondary (maroon) */
body.student-mode {
    --accent-primary: var(--color-navy);
    --accent-primary-hover: var(--color-navy-hover);
    --accent-secondary: var(--color-maroon);
    --accent-secondary-hover: var(--color-maroon-hover);
    --bg-tint: rgba(114, 47, 55, 0.15);
}

/* ========================================
   2. CSS Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(var(--bg-tint), var(--bg-tint)), var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ========================================
   3. Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

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

/* ========================================
   4. Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-danger { color: var(--color-danger); }

.bg-base { background-color: var(--bg-base); }
.bg-elevated { background-color: var(--bg-elevated); }
.bg-highlight { background-color: var(--bg-highlight); }

.mono-time {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ========================================
   5. Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Primary Button - Outline style */
.btn-primary {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-primary:hover:not(:disabled) {
    color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    box-shadow: 0 0 15px currentColor;
}

/* Secondary Button - Uses secondary color */
.btn-secondary {
    background-color: transparent;
    color: var(--accent-secondary);
    border: 2px solid var(--accent-secondary);
}

.btn-secondary:hover:not(:disabled) {
    color: var(--accent-secondary-hover);
    border-color: var(--accent-secondary-hover);
    box-shadow: 0 0 15px currentColor;
}

/* Outline Button - Same as primary */
.btn-outline {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-outline:hover:not(:disabled) {
    color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    box-shadow: 0 0 15px currentColor;
}

/* Danger Button - Outline style */
.btn-danger {
    background-color: transparent;
    color: var(--color-danger);
    border: 2px solid var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
    color: #ff6b6b;
    border-color: #ff6b6b;
    box-shadow: 0 0 15px currentColor;
}

/* Ghost Button - Subtle outline on hover */
.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 2px solid transparent;
    padding: 8px 16px;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Icon Button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-icon:hover:not(:disabled) {
    color: var(--text-primary);
    background-color: var(--bg-highlight);
}

/* Play Button - Large circular outline */
.btn-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-play:hover:not(:disabled) {
    transform: scale(1.08);
    color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    box-shadow: 0 0 20px currentColor;
}

/* Small button variant */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.75rem;
}

/* ========================================
   5b. Gradient Button - iOS-aligned filled action button
   ======================================== */
.btn-gradient {
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 700;
}

.btn-gradient:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-gradient:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-gradient:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-gradient.success {
    background: var(--color-success-green);
}

/* ========================================
   5c. Underline Tabs (aligned with iOS)
   ======================================== */
.underline-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xxl);
    align-items: center;
}

.underline-tab {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.underline-tab:hover {
    color: var(--text-secondary);
}

.underline-tab.active {
    color: var(--color-accent);
}

.underline-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-accent);
    border-radius: 1px 1px 0 0;
}

/* ========================================
   6. Cards
   ======================================== */
.card {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: background-color var(--transition-normal);
}

.card:hover {
    background-color: var(--bg-highlight);
}

.card-flat {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 16px;
}

/* ========================================
   7. Header / Navigation
   ======================================== */
header {
    height: 64px;
    padding: 0 24px;
    background-color: var(--bg-elevated);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--text-primary);
}

/* ========================================
   8. Sidebar
   ======================================== */
.sidebar {
    background-color: var(--bg-elevated);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   9. Form Elements
   ======================================== */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* ========================================
   10. Lists
   ======================================== */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.list-item:hover {
    background-color: var(--bg-highlight);
}

.list-item.active {
    background-color: var(--bg-highlight);
}

/* ========================================
   11. Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--bg-highlight);
    border-radius: var(--radius-full);
    border: 3px solid transparent;
    background-clip: content-box;
}

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

/* ========================================
   12. Dividers
   ======================================== */
hr {
    border: none;
    height: 1px;
    background-color: var(--divider-color);
    margin: 24px 0;
}

/* ========================================
   13. Profile Elements
   ======================================== */
.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

/* ========================================
   14. Status & Badges
   (Base .badge and content badges defined in shared-components.css)
   ======================================== */
.badge-success {
    background-color: rgba(114, 47, 55, 0.3);
    color: var(--accent-primary);
}

.badge-warning {
    background-color: rgba(255, 164, 43, 0.2);
    color: var(--color-warning);
}

.badge-danger {
    background-color: rgba(233, 20, 41, 0.2);
    color: var(--color-danger);
}

/* ========================================
   15. Modal / Overlay
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal,
.modal-content {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 4vw, 32px);
    width: min(90vw, 480px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========================================
   16. Progress Bar
   ======================================== */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--bg-highlight);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

/* ========================================
   17. Tooltips
   ======================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: var(--bg-highlight);
    color: var(--text-primary);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* ========================================
   18. Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.animate-fade-in {
    animation: fadeIn var(--transition-normal);
}

.animate-slide-up {
    animation: slideUp var(--transition-slow);
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ========================================
   19. Upload Progress (In-List)
   ======================================== */
.upload-progress-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-highlight);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.upload-progress-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-progress-percent {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.upload-progress-bar-container {
    height: 6px;
    background: var(--bg-base);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 10px;
}

.upload-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width 0.2s ease;
}

.upload-cancel-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-cancel-btn:hover {
    background: var(--color-danger);
    color: var(--text-primary);
}

/* ========================================
   21. Utility Classes
   ======================================== */
.hidden { display: none !important; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.75rem; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.no-link { text-decoration: none; color: inherit; }

/* ========================================
   22. Upload Source Tabs (Cloud Import)
   ======================================== */
.upload-source-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.upload-tab-content {
    display: none;
}

.upload-tab-content.active {
    display: block;
}

.cloud-browse-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-highlight);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cloud-browse-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.cloud-file-selected {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-highlight);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.cloud-file-selected .cloud-file-name {
    color: var(--text-primary);
    font-weight: 600;
}

.cloud-file-selected .cloud-file-size {
    color: var(--text-muted);
    margin-left: 8px;
}

.picker-buttons {
    flex-wrap: wrap;
}

.picker-import-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================
   23. Beta Badge
   ======================================== */
.beta-badge {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 2px 5px;
    vertical-align: super;
}
