/**
 * Enuvak Creative Studio - Design System & UI Styles
 * Palette: #ffffff, #f8fafc, #e2e8f0, #0f172a, #475569, #4f46e5, #10b981
 */

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

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #4f46e5;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --header-height: 64px;
    --sidebar-left-width: 380px;
    --sidebar-right-width: 360px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================================
   TOP APP HEADER
   ============================================================ */
.studio-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.studio-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 800;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.studio-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 900;
}

.project-title-input {
    border: 1px solid transparent;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    max-width: 260px;
}

.project-title-input:hover,
.project-title-input:focus {
    border-color: var(--border-color);
    background: var(--bg-input);
    outline: none;
}

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

.nav-pill-group {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 2px;
}

.nav-pill {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.nav-pill:hover {
    color: var(--text-primary);
}

.nav-pill.active {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

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

/* ============================================================
   BUTTONS & BADGES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-green { background: var(--success-light); color: var(--success); }
.badge-blue  { background: var(--accent-light); color: var(--accent); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-gray  { background: #f1f5f9; color: var(--text-secondary); }

/* ============================================================
   MAIN 3-COLUMN STUDIO LAYOUT
   ============================================================ */
.studio-layout {
    display: grid;
    grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* LEFT SIDEBAR */
.sidebar-left {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    overflow-x: auto;
}

.sidebar-tab-btn {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.sidebar-tab-btn:hover {
    color: var(--text-primary);
}

.sidebar-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--bg-card);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* CENTER WORKSPACE */
.studio-workspace {
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.workspace-toolbar {
    height: 48px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 10;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
    position: relative;
}

.canvas-shadow-wrapper {
    background: transparent;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

#studioCanvas {
    display: block;
    cursor: default;
    border-radius: var(--radius-sm);
}

/* BOTTOM CAROUSEL SLIDES BAR */
.carousel-slides-bar {
    height: 96px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    overflow-x: auto;
    z-index: 10;
}

.slide-thumb-card {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.15s ease;
}

.slide-thumb-card:hover {
    border-color: #cbd5e1;
}

.slide-thumb-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
    color: var(--accent);
}

.slide-thumb-badge {
    position: absolute;
    bottom: 4px;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
}

.add-slide-btn {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-slide-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* RIGHT SIDEBAR */
.sidebar-right {
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-right-header {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    background: #fafafa;
}

.right-tab-btn {
    flex: 1;
    padding: 14px 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.right-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--bg-card);
}

.right-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

/* ============================================================
   FORM CONTROLS & INSPECTOR
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-circle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0;
    background: transparent;
}

/* TEMPLATES & MEDIA CARDS GRID */
.templates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.template-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.template-preview {
    height: 90px;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    text-align: center;
}

.template-info {
    padding: 8px;
}

.template-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.template-category {
    font-size: 10px;
    color: var(--text-muted);
}

/* BRAND KIT PREVIEW BOX */
.brand-kit-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.15s ease;
}

.brand-kit-box:hover {
    border-color: var(--accent);
}

.brand-kit-box.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.brand-color-swatches {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.swatch {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* TOAST */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--text-primary);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.2s ease forwards;
}

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

/* ============================================================
   RESPONSIVE DESIGN (PC + TABLETS + MOBILE)
   ============================================================ */
@media (max-width: 1024px) {
    .studio-layout {
        grid-template-columns: 320px 1fr;
    }
    .sidebar-right {
        display: none; /* Can be toggled on mobile via top right action */
    }
}

@media (max-width: 768px) {
    .studio-header {
        padding: 0 12px;
    }
    .nav-pill-group {
        display: none; /* bottom nav used on mobile */
    }
    .studio-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - var(--header-height) - 56px);
    }
    .sidebar-left {
        display: none;
    }
    .sidebar-left.mobile-open,
    .sidebar-right.mobile-open {
        display: flex;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 56px;
        z-index: 50;
        width: 100%;
    }
    .mobile-bottom-bar {
        display: flex !important;
    }
}

.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-around;
    z-index: 90;
}

.mobile-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
}

.mobile-bar-btn.active {
    color: var(--accent);
}
