/*
 * Musix IA - Premium Stylesheet
 * Inspired by Steinberg Dorico (Dark Mode + Glassmorphism)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-app: #0f111a;
    --bg-panel: rgba(26, 29, 46, 0.7);
    --bg-panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f3f9;
    --text-secondary: #8e94a8;
    --accent: #3b82f6; /* Modern Blue */
    --accent-glow: rgba(59, 130, 246, 0.5);
    --accent-success: #10b981; /* Emerald */
    --accent-warning: #f59e0b;
    --piano-roll-bg: #141724;
    --piano-roll-grid: #222638;
    --piano-white-key: #ffffff;
    --piano-black-key: #11131c;
    --playhead-color: #ef4444;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Landing / Setup Screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at center, #1e223b 0%, #0f111a 100%);
    z-index: 100;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.welcome-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

.welcome-card {
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

.welcome-logo {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.05em;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.btn-compose-large {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: white;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    padding: 16px 36px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(29, 78, 216, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-compose-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(29, 78, 216, 0.6);
}

.btn-compose-large:active {
    transform: translateY(1px);
}

/* App Layout */
.app-container {
    display: grid;
    grid-template-rows: 60px 1fr;
    height: 100vh;
    width: 100vw;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.app-container.visible {
    opacity: 1;
    transform: scale(1);
}

/* Header */
header {
    background: rgba(16, 18, 30, 0.9);
    border-bottom: 1px solid var(--bg-panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-panel-border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-pill strong {
    color: var(--text-primary);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.transport-controls {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-panel-border);
    border-radius: 30px;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-transport {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-transport:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.btn-transport.active {
    color: white;
}

#btn-play.active {
    background: var(--accent-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

#btn-stop:active {
    background: rgba(239, 68, 68, 0.2);
}

.tempo-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tempo-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-primary);
    width: 50px;
    text-align: center;
    padding: 4px 0;
    border-radius: 6px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-action-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn-action-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5);
}

/* Main Workspace */
.workspace {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    height: calc(100vh - 60px);
}

/* Sidebar Left (Notation Options) */
.sidebar-left {
    background: rgba(16, 18, 30, 0.5);
    border-right: 1px solid var(--bg-panel-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.notation-tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-tool {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.btn-tool.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-tool svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Center Editor Split Pane */
.editor-pane {
    display: grid;
    grid-template-rows: 1fr 1fr;
    height: 100%;
    overflow: hidden;
}

/* Sheet Music Area */
.sheet-music-container {
    background: #f8f9fa; /* White/Cream paper like Dorico */
    border-bottom: 3px solid var(--bg-panel-border);
    overflow: auto;
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#sheet-canvas {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

/* Piano Roll Area */
.piano-roll-container {
    background: var(--piano-roll-bg);
    display: grid;
    grid-template-columns: 80px 1fr;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.piano-keys {
    background: var(--piano-black-key);
    border-right: 2px solid var(--bg-panel-border);
    overflow-y: auto;
    height: 100%;
    scrollbar-width: none; /* Hide scrollbar */
}
.piano-keys::-webkit-scrollbar {
    display: none;
}

.piano-key {
    height: 24px; /* Matches row height */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.piano-key.white {
    background: var(--piano-white-key);
    color: #333;
}

.piano-key.black {
    background: var(--piano-black-key);
    color: #fff;
}

.piano-key.active {
    background: var(--accent-warning) !important;
    color: black !important;
}

.piano-grid-viewport {
    overflow: auto;
    height: 100%;
    width: 100%;
    position: relative;
}

.piano-grid-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.piano-roll-playhead {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: var(--playhead-color);
    box-shadow: 0 0 8px var(--playhead-color);
    pointer-events: none;
    z-index: 10;
    left: 0;
}

/* Sidebar Right (Lyrics & AI details) */
.sidebar-right {
    background: rgba(16, 18, 30, 0.5);
    border-left: 1px solid var(--bg-panel-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.lyrics-editor-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 200px;
}

.lyrics-textarea {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-panel-border);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 12px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.lyrics-textarea:focus {
    border-color: var(--accent);
}

.sidebar-section-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-panel-border);
    border-radius: 12px;
    padding: 16px;
}

.sidebar-section-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Project History Picker */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.song-list-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--bg-panel-border);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
}

.song-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(59, 130, 246, 0.1);
    border-top: 6px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}
