/* dashboard/css/style.css - Clean Enterprise Light SaaS Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Pure Clean Light Palette */
    --bg-canvas: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f1f5f9;
    --bg-surface-hover: #f8fafc;

    /* Crisp Hairline Borders */
    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-focus: #2563eb;

    /* High-Contrast Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Brand & Accent Colors */
    --brand-primary: #2563eb;
    --brand-primary-hover: #1d4ed8;
    --brand-primary-light: #eff6ff;

    /* Status Colors */
    --status-success: #16a34a;
    --status-success-bg: #f0fdf4;
    --status-success-border: #bbf7d0;

    --status-warning: #d97706;
    --status-warning-bg: #fffbeb;
    --status-warning-border: #fde68a;

    --status-danger: #dc2626;
    --status-danger-bg: #fef2f2;
    --status-danger-border: #fecaca;

    /* Sharp Enterprise Radii (Strictly 4px - 6px) */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Subtle Elevation */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

    /* Transitions */
    --transition: 0.15s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 0.95rem; }

code, pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

/* ==========================================================================
   APP SHELL & LAYOUT
   ========================================================================== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
}

.brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0 12px 18px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.brand-badge {
    background: var(--brand-primary);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-section-title {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    padding: 12px 12px 6px 12px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item.active i {
    color: var(--brand-primary);
}

/* Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.content-body {
    padding: 28px;
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   CARDS & PANELS (Sharp Rectangles)
   ========================================================================== */
.card, .glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ==========================================================================
   BUTTONS (Sharp Rectangles)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.25;
}

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

.btn-primary:hover {
    background: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: #ffffff;
}

.btn-outline {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-surface-secondary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ==========================================================================
   FORMS & INPUTS (Sharp Rectangles)
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-primary-light);
}

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

/* Length Selector Radio Cards */
.length-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.length-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    background: var(--bg-surface);
    transition: all var(--transition);
    position: relative;
}

.length-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-surface-secondary);
}

.length-card.selected {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
}

.length-card input[type="radio"] {
    position: absolute;
    top: 14px;
    right: 14px;
}

.length-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.length-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   TABLES (Clean Hairline Borders)
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.86rem;
}

.custom-table th {
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.custom-table td {
    padding: 12px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.custom-table tr:hover td {
    background: var(--bg-surface-hover);
}

/* ==========================================================================
   BADGES (Sharp, Minimal)
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-indigo { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.badge-green  { background: var(--status-success-bg); color: var(--status-success); border-color: var(--status-success-border); }
.badge-amber  { background: var(--status-warning-bg); color: var(--status-warning); border-color: var(--status-warning-border); }
.badge-rose   { background: var(--status-danger-bg); color: var(--status-danger); border-color: var(--status-danger-border); }
.badge-blue   { background: #f0f9ff; color: #0284c7; border-color: #e0f2fe; }

/* Pulse Indicator */
.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-success);
    display: inline-block;
}

/* ==========================================================================
   STATS GRID
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 16px 20px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-trend {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .sidebar { width: 60px; padding: 14px 6px; }
    .sidebar .brand span, .sidebar .nav-section-title, .sidebar .nav-item span { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 10px; }
    .top-navbar, .content-body { padding: 16px; }
}

/* Studio Stepper Bar (Sharp Minimalist) */
.studio-stepper {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    margin-bottom: 24px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    overflow-x: auto;
}

.studio-step-item {
    flex: 1;
    padding: 14px 18px;
    text-align: center;
    border-bottom: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.studio-step-item.active {
    border-bottom-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--bg-canvas);
}

.studio-step-item.completed {
    color: var(--status-success);
}

/* ==========================================
   AI LIVE PROGRESS RADAR & ENTERTAINING LOADER
   ========================================== */
.ai-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ai-progress-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ai-progress-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: 580px;
    width: 100%;
    padding: 32px;
    position: relative;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.ai-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ai-progress-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ai-progress-subtitle {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.ai-timer-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-primary-light);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.ai-progress-bar-wrap {
    height: 8px;
    background: var(--bg-surface-secondary);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    margin: 20px 0 24px 0;
    border: 1px solid var(--border-subtle);
}

.ai-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2563eb, #4f46e5, #0ea5e9);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.ai-milestones-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.ai-milestone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.86rem;
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.ai-milestone-item.active {
    color: var(--brand-primary);
    font-weight: 600;
}

.ai-milestone-item.done {
    color: var(--status-success);
}

.ai-milestone-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ai-milestone-item.active .ai-milestone-indicator {
    border-color: var(--brand-primary);
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

.ai-milestone-item.done .ai-milestone-indicator {
    border-color: var(--status-success);
    background: var(--status-success);
    color: #ffffff;
}

.ai-tip-box {
    padding: 14px 16px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ai-tip-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-primary);
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.ai-tip-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    transition: opacity 0.3s ease;
}

/* ==========================================
   DYNAMIC BLOG FORMAT EDITORIAL COMPONENTS
   ========================================== */
.callout-box {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin: 24px 0;
    border-left: 4px solid var(--brand-primary);
    background: var(--bg-surface-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

.callout-box.info {
    border-left-color: var(--brand-primary);
    background: #f0f7ff;
    border: 1px solid #dbeafe;
    border-left-width: 4px;
}

.takeaways-box {
    padding: 18px 22px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #4f46e5;
    border-radius: var(--radius-sm);
    margin: 24px 0;
}

.takeaways-box h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.step-card {
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin: 20px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.step-number {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffffff;
    background: var(--brand-primary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.formula-box {
    padding: 16px 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #16a34a;
    border-radius: var(--radius-sm);
    margin: 20px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    color: #15803d;
}

.mistake-card {
    padding: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin: 20px 0;
}

.mistake-header {
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.fix-header {
    color: #16a34a;
    font-weight: 600;
    font-size: 0.95rem;
}

.review-card {
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin: 24px 0;
    border-top: 3px solid var(--brand-primary);
}

.pro-tip {
    margin: 20px 0;
    padding: 14px 18px;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-sm);
    font-style: italic;
    color: #92400e;
}

.checklist-items {
    list-style: none;
    padding-left: 0;
}

.checklist-items li {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}