/**
 * LuminaNote Studio - Master Application CSS & Design System
 */

:root {
    --bg-main: #0B0F19;
    --bg-surface: #0F172A;
    --bg-card: #1E293B;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --brand-primary: #3B82F6;
    --brand-accent: #F59E0B;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* App Header */
.app-header {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 40;
}

/* Brand Logo */
.brand-logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3B82F6, #6366F1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #FFFFFF;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

/* Editable Project Title Input */
.project-title-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    transition: all 0.15s ease;
    max-width: 260px;
}

.project-title-input:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.project-title-input:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--brand-primary);
    outline: none;
}

/* Buttons */
.n8n-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.n8n-btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    border-color: var(--border-color);
}

/* ==========================================================================
   DASHBOARD VIEW STYLES
   ========================================================================== */
.dashboard-container {
    flex: 1;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 0%, #172554 0%, #0B0F19 60%);
    padding: 32px;
}

.notebook-card {
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    cursor: pointer;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.notebook-card:hover {
    transform: translateY(-6px);
    border-color: #3B82F6;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(59, 130, 246, 0.25);
}

.notebook-thumb-wrapper {
    width: 100%;
    height: 220px;
    background: #030712;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 12px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Create New Notebook Starter Card */
.create-notebook-card {
    background: rgba(15, 23, 42, 0.5);
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    min-height: 310px;
    transition: all 0.2s ease;
}

.create-notebook-card:hover {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.08);
    transform: translateY(-4px);
}

/* ==========================================================================
   MODAL SYSTEM
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(16px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 92vh;
}

/* Full-Width Luxury Template Gallery Modal */
.tpl-gallery-modal {
    width: 95vw;
    max-width: 1400px;
    height: 88vh;
}

/* Luxury Two-Panel Sidebar Item */
.tpl-sidebar-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: #94A3B8;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.tpl-sidebar-item:hover {
    background: rgba(30, 41, 59, 0.6);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.05);
}

.tpl-sidebar-item.is-active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.15));
    border-color: rgba(59, 130, 246, 0.4);
    color: #FFFFFF;
}

.tpl-sidebar-item.is-active .count-badge {
    background: #2563EB;
    color: #FFFFFF;
}

.tpl-gallery-grid {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    align-content: start;
    background: radial-gradient(circle at 50% 0%, #172554 0%, #0B0F19 60%);
}

.tpl-gallery-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
}

.tpl-gallery-card:hover {
    transform: translateY(-5px);
    border-color: #3B82F6;
    box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   INTERACTIVE LIGHTBOX MODAL
   ========================================================================== */
.lightbox-modal {
    width: 90vw;
    max-width: 1050px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.lightbox-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #030712 80%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.lightbox-canvas-wrapper {
    box-shadow: 0 25px 70px -10px rgba(0, 0, 0, 0.95), 0 0 40px rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   GLOBAL LUXURY LOADING OVERLAY
   ========================================================================== */
.global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-loading-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.loading-glass-card {
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 24px;
    padding: 32px 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(59, 130, 246, 0.25);
    animation: loaderPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loaderPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1.0); opacity: 1; }
}

.loading-spinner-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(59, 130, 246, 0.15);
    border-top-color: #3B82F6;
    border-right-color: #10B981;
    animation: spinLoaderRing 0.75s linear infinite;
}

@keyframes spinLoaderRing {
    to { transform: rotate(360deg); }
}
