/* ===== Home Layout: Sidebar | Main ===== */
#home {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ===== Sidebar (Sketches) ===== */
#home-sidebar {
    width: 240px;
    min-width: 240px;
    border-right: 1px solid #222;
    background: #111;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-header {
    padding: 16px 16px 12px 16px;
    border-bottom: 1px solid #1a1a1a;
}
.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 16px 8px;
}
.sidebar-empty {
    color: #444;
    font-size: 12px;
    font-style: italic;
    padding: 12px 8px;
}

/* Date group label */
.sidebar-group-label {
    font-size: 10px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px 6px 8px;
}
.sidebar-group-label:first-child {
    padding-top: 4px;
}

/* Sketch item */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 8px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.sidebar-item:hover {
    background: #1a1a1a;
}
.sidebar-item-name {
    flex: 1;
    font-size: 13px;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-item:hover .sidebar-item-name {
    color: #fff;
}

/* Sketch date (relative) */
.sidebar-item-date {
    font-size: 10px;
    color: #333;
    font-family: monospace;
    flex-shrink: 0;
    white-space: nowrap;
}
.sidebar-item:hover .sidebar-item-date {
    color: #555;
}

/* Delete button (hidden until hover) */
.sidebar-delete {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s;
}
.sidebar-item:hover .sidebar-delete {
    opacity: 1;
    color: #555;
}
.sidebar-delete:hover {
    color: #e06c75 !important;
    background: rgba(224, 108, 117, 0.1);
}

/* ===== Main Content ===== */
#home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ① Static prompt zone — does NOT scroll */
.home-prompt-wrapper {
    flex-shrink: 0;
    border-bottom: 1px solid #1a1a1a;
}
.home-prompt-wrapper .home-main-inner {
    padding: 32px 32px 24px 32px;
}

/* ② Scrollable zone — templates only */
.home-main-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.home-main-scroll .home-main-inner {
    padding: 24px 32px 40px 32px;
}

/* Shared inner container */
.home-main-inner {
    max-width: 700px;
    margin: 0 auto;
}

/* ===== 1. Hero: Welcome + Prompt ===== */
.home-hero {
    /* no margin-bottom — wrapper handles spacing */
}
.home-hero h1 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 20px;
}

/* ===== Prompt Box — card style ===== */
.home-prompt-box {
    background: #151515;
    border: 1px solid #444;
    border-radius: 16px;
    padding: 14px 16px 12px 16px;
    transition: border-color 0.2s;
}
.home-prompt-box:focus-within {
    border-color: #666;
}

/* Textarea */
.home-prompt-input {
    width: 100%;
    min-height: 60px;
    max-height: 150px;
    padding: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    resize: none;
}
.home-prompt-input:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.home-prompt-input::placeholder {
    color: #444;
}

/* Bottom row: model selector | + credits | Create → */
.home-prompt-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 10px;
}

/* "+ credits" inline button */
.home-add-credits-btn {
    height: 28px;
    padding: 0 10px;
    background: none;
    border: 1px solid #282828;
    border-radius: 6px;
    color: #555;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.home-add-credits-btn:hover {
    color: #4fc3f7;
    border-color: rgba(79, 195, 247, 0.35);
    background: rgba(79, 195, 247, 0.06);
}

/* Create → button pushed to the right */
.home-prompt-go {
    height: 36px;
    padding: 0 20px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}
.home-prompt-go:hover:not(:disabled) {
    opacity: 0.85;
}
.home-prompt-go:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* ===== Home Model Selector ===== */
.home-model-selector {
    position: relative;
}
.home-model-trigger {
    background: none;
    border: none;
    color: #555;
    font-size: 11px;
    font-family: monospace;
    cursor: pointer;
    padding: 2px 0;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.home-model-trigger:hover {
    color: #aaa;
}
.home-model-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 240px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 4px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    max-height: 360px;
    overflow-y: auto;
}
.home-model-opt {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #aaa;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.home-model-opt:hover:not(.locked) {
    background: #2a2a2a;
    color: #fff;
}
.home-model-opt.active {
    color: #fff;
    background: #252525;
}
/* ===== Locked model (unaffordable) ===== */
.home-model-opt.locked {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}
.home-model-badge {
    font-size: 9px;
    font-weight: 700;
    font-family: monospace;
    padding: 2px 6px;
    border-radius: 4px;
    background: #2a2a2a;
    color: #555;
    margin-left: auto;
}
.home-model-opt:hover:not(.locked) .home-model-badge {
    background: #333;
    color: #888;
}

/* ===== Disabled state (at limit) ===== */
.home-disabled {
    opacity: 0.35;
    cursor: not-allowed !important;
    pointer-events: auto;
}
.home-disabled:hover {
    opacity: 0.45;
}

/* ===== Sections ===== */
.home-section {
    margin-bottom: 40px;
}
.home-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Templates — Category Sections (Home) ===== */
.home-templates-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.home-templates-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.home-templates-category {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.3px;
}
.home-templates-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.home-template-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #151515;
    border: 1px solid #222;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}
.home-template-card:hover {
    background: #1e1e1e;
    border-color: #444;
}
.home-template-icon {
    width: 30px;
    height: 30px;
    background: #222;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 15px;
    color: #888;
    flex-shrink: 0;
}
.home-template-card:hover .home-template-icon {
    color: #fff;
    background: #333;
}
.home-template-name {
    font-size: 13px;
    color: #aaa;
    font-weight: 500;
}
.home-template-card:hover .home-template-name {
    color: #fff;
}

/* ===== Plan Bar — pinned at bottom ===== */
.home-plan-bar {
    flex-shrink: 0;
    border-top: 1px solid #242424;
    background: rgba(17, 17, 17, 0.96);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 46px;
    box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.22);
}
.home-plan-left,
.home-plan-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.home-plan-left {
    flex: 1;
}
.home-plan-right {
    flex-shrink: 0;
}
.home-plan-usage {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: #e5e5e5;
    white-space: nowrap;
}
.home-plan-badge {
    font-size: 10px;
    font-weight: 800;
    font-family: monospace;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.home-plan-badge.free {
    color: #aaa;
    background: #202020;
    border: 1px solid #333;
}
.home-plan-badge.pro {
    color: #4fc3f7;
    background: rgba(79, 195, 247, 0.12);
    border: 1px solid rgba(79, 195, 247, 0.25);
}
.home-credits-btn,
.home-plan-upgrade-btn,
.home-plan-manage-btn {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.home-credits-btn {
    padding: 0 10px;
    color: #4fc3f7;
    background: rgba(79, 195, 247, 0.10);
    border: 1px solid rgba(79, 195, 247, 0.30);
}
.home-credits-btn:hover {
    color: #101010;
    background: #4fc3f7;
    border-color: #4fc3f7;
}
.home-plan-upgrade-btn {
    padding: 0 12px;
    color: #000;
    background: #fff;
    border: 1px solid #fff;
}
.home-plan-upgrade-btn:hover {
    background: #4fc3f7;
    border-color: #4fc3f7;
}
.home-plan-manage-btn {
    height: 28px;
    padding: 0 4px;
    color: #777;
    background: transparent;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
}
.home-plan-manage-btn:hover {
    color: #fff;
    background: #1c1c1c;
    border-color: #333;
    padding: 0 9px;
}
.home-plan-bar button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 760px) {
    .home-plan-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }
    .home-plan-left,
    .home-plan-right {
        width: 100%;
        justify-content: space-between;
    }
}