/* ============================================================
   FotoDigital Photobook - Theme Selector (MediaClip style)
   ============================================================ */

.photobook-theme-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e8ebee;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photobook-theme-overlay.visible {
    opacity: 1;
}

.photobook-theme-modal {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */

.theme-modal-header {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.theme-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    color: #222;
    font-family: 'Roboto', Arial, sans-serif;
}

.theme-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.theme-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* ── Theme Grid ───────────────────────────────────────────── */

.theme-grid {
    flex: 1;
    overflow-y: auto;
    padding: 30px 50px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    align-content: start;
    width: 100%;
    box-sizing: border-box;
}

.theme-grid::-webkit-scrollbar { width: 8px; }
.theme-grid::-webkit-scrollbar-track { background: transparent; }
.theme-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.theme-grid::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Theme Card ──────────────────────────────────────────── */

.theme-card {
    background: #fff;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #2196F3;
}

/* ── Card Preview (thumbnail image) ──────────────────────── */

.theme-card-preview {
    width: 100%;
    padding-bottom: 49.7%;  /* 397/799 = 0.497 → maintains 799:397 ratio */
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.theme-card-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.theme-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
    font-family: serif;
}

/* ── Card Info (name + select button) ────────────────────── */

.theme-card-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #eee;
    min-height: 44px;
}

.theme-card-name {
    font-size: 14px;
    font-weight: 400;
    color: #333;
    font-family: 'Roboto', Arial, sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    line-height: 1.3;
}

.theme-card-select-btn {
    padding: 6px 16px;
    background: transparent;
    color: #2196F3;
    border: 1px solid #2196F3;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: 'Roboto', Arial, sans-serif;
}

.theme-card-select-btn:hover {
    background: #2196F3;
    color: #fff;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .theme-card-info {
        flex-direction: column;
        text-align: center;
    }

    .theme-card-name {
        white-space: normal;
    }
}

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

@media (min-width: 1200px) {
    .theme-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
