/* === DASHBOARD.CSS ===
   assets/css/dashboard.css
   НАЗНАЧЕНИЕ: Lovable-style дашборд — sidebar + hero + showcase
   СТИЛЬ: индустриальное/утилитарное, dark-first
*/

/* ============================================
   LAYOUT
============================================ */
.db-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ============================================
   SIDEBAR
============================================ */
.db-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

/* Logo */
.db-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.db-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.db-logo-icon svg {
    width: 18px;
    height: 18px;
}

.db-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* New Project Button */
.db-btn-new {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    width: calc(100% - 24px);
}

.db-btn-new:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.db-btn-new svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Section label */
.db-sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.db-sidebar-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 10px 16px 4px;
}

/* Project items in sidebar */
.db-sidebar-projects {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.db-sidebar-project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.14s;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.84rem;
    overflow: hidden;
}

.db-sidebar-project-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.db-sidebar-project-item.active {
    background: color-mix(in oklch, var(--color-primary), transparent 85%);
    color: var(--color-primary);
}

.db-sidebar-project-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    opacity: 0.5;
}

.db-sidebar-project-item.active .db-sidebar-project-dot {
    opacity: 1;
}

.db-sidebar-project-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-sidebar-project-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Skeleton items */
.db-sidebar-skeleton {
    height: 34px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    margin: 2px 0;
    animation: db-shimmer 1.4s infinite;
}

/* Sidebar Footer */
.db-sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.db-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background 0.14s, color 0.14s;
}

.db-sidebar-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.db-sidebar-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.db-sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* User block */
.db-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}

.db-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.db-user-info {
    flex: 1;
    overflow: hidden;
}

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

.db-user-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-user-logout {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, color 0.14s;
    flex-shrink: 0;
}

.db-user-logout:hover {
    background: color-mix(in oklch, var(--color-danger, oklch(60% 0.22 25)), transparent 85%);
    color: var(--color-danger, oklch(60% 0.22 25));
}

.db-user-logout svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   MAIN
============================================ */
.db-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HERO SECTION
============================================ */
.db-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px 60px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.db-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 60% at 50% 0%, color-mix(in oklch, var(--color-primary), transparent 88%), transparent 70%);
    pointer-events: none;
}

.db-hero-content {
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.db-hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-primary);
    margin: 0 0 16px;
    text-wrap: balance;
}

.db-hero-name {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.db-hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin: 0 0 32px;
    line-height: 1.5;
}

.db-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 12px;
    background: var(--color-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
    box-shadow: 0 4px 20px color-mix(in oklch, var(--color-primary), transparent 60%);
}

.db-btn-hero:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px color-mix(in oklch, var(--color-primary), transparent 50%);
}

.db-btn-hero svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   DEMO SHOWCASE
============================================ */
.db-showcase {
    padding: 40px;
    flex: 1;
}

.db-showcase-header {
    margin-bottom: 24px;
}

.db-showcase-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.db-showcase-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin: 0;
}

.db-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* Demo Card */
.db-demo-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
    text-decoration: none;
    display: block;
}

.db-demo-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 24px oklch(0% 0 0 / 0.2);
}

.db-demo-screenshot {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
    background: var(--bg-tertiary);
}

.db-demo-info {
    padding: 12px;
}

.db-demo-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-demo-niche {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Skeleton for demo cards */
.db-demo-skeleton {
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    aspect-ratio: 4/3;
    animation: db-shimmer 1.4s infinite;
}

/* ============================================
   MODAL FORM SPECIFICS
============================================ */
.db-modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.db-prompt-textarea {
    resize: vertical;
    min-height: 180px;
    max-height: 480px;
    font-size: 0.9rem;
    line-height: 1.55;
}

.db-prompt-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ============================================
   GENERATION OVERLAY (10 seconds)
============================================ */
.db-gen-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    animation: db-fade-in 0.35s ease;
}

.db-gen-overlay.db-fade-out {
    animation: db-fade-out 0.4s ease forwards;
}

.db-gen-orb {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-primary) 0%, color-mix(in oklch, var(--color-secondary, var(--color-primary)), transparent 40%) 100%);
    animation: db-orb-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 60px color-mix(in oklch, var(--color-primary), transparent 40%);
}

.db-gen-text {
    text-align: center;
}

.db-gen-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.db-gen-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.db-gen-progress {
    width: 200px;
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.db-gen-progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary, var(--color-primary)));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}

/* ============================================
   ANIMATIONS
============================================ */
@keyframes db-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes db-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes db-orb-pulse {
    0%, 100% { transform: scale(1);     opacity: 1;   }
    50%       { transform: scale(1.12); opacity: 0.75; }
}

@keyframes db-shimmer {
    0%   { opacity: 1; }
    50%  { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 768px) {
    .db-layout {
        flex-direction: column;
    }

    .db-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .db-sidebar-section {
        display: none;
    }

    .db-hero {
        padding: 50px 20px 40px;
    }

    .db-showcase {
        padding: 24px 20px;
    }

    .db-showcase-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .db-showcase-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SIDEBAR — EMPTY STATE
============================================ */
.db-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.db-sidebar-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--color-primary, #22d3ee);
    background: transparent;
    border: 1px dashed var(--color-primary, #22d3ee);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.db-sidebar-empty-cta:hover {
    background: rgba(34, 211, 238, 0.08);
}
.db-sidebar-empty-cta i {
    width: 12px;
    height: 12px;
}

/* ============================================
   ONBOARDING BANNER
============================================ */
.db-onboarding {
    display: none;
    align-items: flex-start;
    gap: 20px;
    background: linear-gradient(135deg, rgba(34,211,238,0.06) 0%, rgba(167,139,250,0.06) 100%);
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 32px;
}

.db-onboarding-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(34,211,238,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary, #22d3ee);
}
.db-onboarding-icon i { width: 24px; height: 24px; }

.db-onboarding-content { flex: 1; }

.db-onboarding-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.db-onboarding-text {
    font-size: 0.875rem;
    color: var(--text-secondary, var(--text-muted));
    margin: 0 0 16px;
    line-height: 1.5;
}

.db-onboarding-steps {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.db-onboarding-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary, var(--text-muted));
}

.db-onboarding-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary, #22d3ee);
    color: #000;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ============================================
   MODAL TABS (Создать / Клонировать)
   ============================================ */
.db-modal-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    padding-bottom: 14px;
}

.db-modal-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
}
.db-modal-tab i { width: 15px; height: 15px; }
.db-modal-tab:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.db-modal-tab.active {
    background: rgba(34,211,238,0.1);
    border-color: rgba(34,211,238,0.35);
    color: var(--color-primary, #22d3ee);
}

/* Clone mode cards */
.db-clone-mode-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.db-clone-mode-option { cursor: pointer; }
.db-clone-mode-option input { display: none; }

.db-clone-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    text-align: center;
    transition: all 0.18s;
}
.db-clone-mode-card i {
    width: 22px; height: 22px;
    color: var(--text-muted, #9ca3af);
}
.db-clone-mode-card strong {
    font-size: 0.875rem;
    color: var(--text-primary);
}
.db-clone-mode-card span {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    line-height: 1.4;
}
.db-clone-mode-option input:checked + .db-clone-mode-card {
    border-color: var(--color-primary, #22d3ee);
    background: rgba(34,211,238,0.07);
}
.db-clone-mode-option input:checked + .db-clone-mode-card i {
    color: var(--color-primary, #22d3ee);
}
.db-clone-mode-option:hover .db-clone-mode-card {
    border-color: rgba(34,211,238,0.3);
}
