/* ============================================================
   Slideshow Generator — Mobile-first, touch-friendly styling
   ============================================================ */

/* Page wrapper */
.sg-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4px;
}

.sg-page h3 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

/* ---- Cards (panels) ---- */
.sg-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    background: #1e1e2e;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.sg-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    background: rgba(255,255,255,0.03);
    -webkit-tap-highlight-color: transparent;
    min-height: 52px;
}

.sg-card-header:active {
    background: rgba(255,255,255,0.06);
}

.sg-card-header .sg-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-card-header .sg-title .sg-subtitle {
    font-weight: 400;
    color: #888;
    font-size: 0.82rem;
}

.sg-card-header .sg-chevron {
    color: #666;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.sg-card-body {
    padding: 16px 18px 18px;
}

/* ---- Action bar (Add Slide, Export etc) ---- */
.sg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 14px 0;
}

.sg-actions .form-control {
    min-width: 0;
    flex: 1 1 200px;
}

/* ---- Buttons — bigger touch targets ---- */
.sg-page .btn {
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.sg-page .btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 40px;
    border-radius: 8px;
}

/* Primary accent */
.sg-page .btn-primary,
.sg-page .btn-accent {
    background: linear-gradient(135deg, #FF6B00 0%, #ff8c33 100%);
    border: none;
    color: #fff;
    font-weight: 600;
}

.sg-page .btn-primary:hover,
.sg-page .btn-accent:hover {
    background: linear-gradient(135deg, #e06000 0%, #ff7a1a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,107,0,0.3);
}

.sg-page .btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
}

.sg-page .btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: #fff;
}

.sg-page .btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: #fff;
}

.sg-page .btn-outline-secondary {
    border-color: rgba(255,255,255,0.15);
    color: #aaa;
}

.sg-page .btn-outline-secondary:hover,
.sg-page .btn-outline-secondary.active {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

.sg-page .btn-outline-danger {
    border-color: rgba(239,68,68,0.4);
    color: #ef4444;
}

.sg-page .btn-outline-danger:hover {
    background: rgba(239,68,68,0.15);
}

/* ---- Form controls ---- */
.sg-page .form-control,
.sg-page .form-select {
    background: #16161e;
    border: 1px solid rgba(255,255,255,0.1);
    color: #e0e0e0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    min-height: 44px;
    transition: border-color 0.15s;
}

.sg-page .form-control:focus,
.sg-page .form-select:focus {
    border-color: #FF6B00;
    background: #1a1a24;
    box-shadow: 0 0 0 3px rgba(255,107,0,0.15);
    color: #fff;
}

.sg-page .form-control::placeholder {
    color: #555;
}

.sg-page .form-control-sm,
.sg-page .form-select-sm {
    padding: 8px 12px;
    font-size: 0.82rem;
    min-height: 40px;
    border-radius: 8px;
}

.sg-page .form-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #999;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sg-page .form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 0.15em;
    background-color: #16161e;
    border-color: rgba(255,255,255,0.15);
}

.sg-page .form-check-input:checked {
    background-color: #FF6B00;
    border-color: #FF6B00;
}

.sg-page .form-check-label {
    padding-left: 4px;
    font-size: 0.85rem;
    color: #ccc;
}

.sg-page textarea.form-control {
    min-height: 60px;
}

/* Color input fix */
.sg-page input[type="color"] {
    padding: 4px !important;
    min-height: 40px;
    cursor: pointer;
}

/* ---- Recent Posts pills ---- */
.sg-recent-posts {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.sg-recent-posts .btn {
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.82rem;
}

/* ---- Typography grid — responsive ---- */
.sg-typo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.sg-typo-grid .sg-typo-label {
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 0.82rem;
    color: #FF6B00;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sg-typo-grid .sg-typo-label:first-child {
    border-top: none;
    padding-top: 0;
}

/* ---- Horizontal Scroll Slides Strip ---- */
.sg-slides-scroll-wrapper {
    margin-bottom: 16px;
}

.sg-slides-scroll-track {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 8px 4px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,107,0,0.3) transparent;
}

.sg-slides-scroll-track::-webkit-scrollbar {
    height: 6px;
}

.sg-slides-scroll-track::-webkit-scrollbar-track {
    background: transparent;
}

.sg-slides-scroll-track::-webkit-scrollbar-thumb {
    background: rgba(255,107,0,0.25);
    border-radius: 3px;
}

.sg-slides-scroll-track::-webkit-scrollbar-thumb:hover {
    background: rgba(255,107,0,0.45);
}

.sg-slide-card {
    flex: 0 0 min(90vw, 500px);
    scroll-snap-align: start;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    background: #1e1e2e;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.sg-slide-canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 8px;
    background: #111118;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sg-slide-canvas-wrap canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

@media (min-width: 768px) {
    .sg-slide-card {
        flex: 0 0 min(60vw, 540px);
    }
}

@media (min-width: 1200px) {
    .sg-slide-card {
        flex: 0 0 480px;
    }
}

/* ---- Slide card ---- */
.sg-slide {
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    background: #1e1e2e;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

/* ---- Slide Header ---- */
.sg-slide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sg-slide-header .sg-slide-num {
    font-weight: 700;
    font-size: 0.9rem;
    color: #FF6B00;
}

.sg-slide-header .sg-slide-actions {
    display: flex;
    gap: 6px;
}

.sg-slide-header .sg-slide-actions .btn {
    padding: 6px 10px;
    min-height: 36px;
    font-size: 0.78rem;
}

.sg-slide-body {
    padding: 14px 16px 16px;
}

/* ---- Details / Summary (collapsible sections) ---- */
.sg-page details {
    margin-bottom: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    overflow: hidden;
}

.sg-page details[open] {
    background: rgba(255,255,255,0.03);
}

.sg-page details summary {
    padding: 10px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #ccc;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 44px;
}

.sg-page details summary::-webkit-details-marker {
    display: none;
}

/* Icon holder — house colour with transparent bg */
.sg-page details summary .sg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 107, 0, 0.12);
    color: #FF6B00;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Chevron on the right */
.sg-page details summary::after {
    content: '\F285'; /* bi-chevron-right */
    font-family: 'bootstrap-icons';
    font-size: 0.65rem;
    color: #666;
    margin-left: auto;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sg-page details[open] summary::after {
    transform: rotate(90deg);
}

.sg-page details summary::before {
    display: none;
}

.sg-page details summary:active {
    background: rgba(255,255,255,0.04);
}

.sg-page details > :not(summary) {
    padding: 0 14px 14px;
}

/* Card header icons */
.sg-card-header .sg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 107, 0, 0.12);
    color: #FF6B00;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* ---- Canvas preview ---- */
.sg-canvas-wrap {
    background: #111118;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
}

.sg-canvas-wrap canvas {
    width: 100%;
    max-width: 540px;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* ---- Border controls grid ---- */
.sg-border-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.sg-border-grid .sg-border-full {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    align-items: end;
}

.sg-copy-btn {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 0.82rem;
    line-height: 1;
    min-width: 36px;
    align-self: stretch;
}

/* ---- Image Filters ---- */
.sg-filter-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 6px;
}

.sg-filter-grid > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-filter-grid .form-label {
    min-width: 80px;
    margin-bottom: 0;
    font-size: 0.78rem;
    color: #aaa;
    flex-shrink: 0;
}

.sg-filter-grid .form-range {
    flex: 1;
    min-width: 0;
}

.sg-filter-val {
    min-width: 48px;
    text-align: right;
    font-size: 0.75rem;
    color: #FF6B00;
    font-weight: 600;
    flex-shrink: 0;
}

.sg-filter-actions {
    justify-content: flex-end;
    padding-top: 4px;
}

/* ---- Status badges ---- */
.sg-page .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
}

/* ---- Empty state ---- */
.sg-empty {
    text-align: center;
    padding: 48px 20px;
    color: #666;
}

.sg-empty .sg-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ---- Alert / error ---- */
.sg-page .alert {
    border-radius: 10px;
    font-size: 0.85rem;
    border: none;
}

.sg-page .alert-danger {
    background: rgba(239,68,68,0.12);
    color: #fca5a5;
}

/* ---- Saved group pill ---- */
.sg-saved-badge {
    background: linear-gradient(135deg, #22c55e20, #16a34a20);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ---- Mobile responsive ---- */
@media (max-width: 768px) {
    .sg-page {
        padding: 0 2px;
    }

    .sg-card-body {
        padding: 14px 14px 16px;
    }

    .sg-slide-body {
        padding: 12px 12px 14px;
    }


    .sg-actions {
        gap: 8px;
    }

    .sg-actions .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .sg-actions .form-control {
        flex: 1 1 100%;
    }

    .sg-typo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 380px) {
    .sg-page .btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

