/* Copyright (c) 2025 Phillippia Fuqua | Unschooled.art */

@font-face {
    font-family: 'DM Serif Text';
    src: url('fonts/DMSerifText-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

body {
    margin: 0;
    padding: 1.5rem;
    background-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1a1a1a;
}

/* Bug 1 fix: also set html element transparent for Safari iframe compatibility */
html {
    background: transparent;
}

/* ── HIDDEN BY DEFAULT ──────────────────────────────────────────────────────
   These elements start hidden and are shown/hidden by JavaScript at runtime.
   Defined here (not inline) so they are not blocked by the CSP style-src policy. */
#prg-unauthorized,
#prg-fallbackControlsContainer,
#prg-intensitySliderContainer,
#prg-gridCanvas {
    display: none;
}

/* ── UNAUTHORIZED SCREEN ── */
#prg-unauthorized {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.unauth-box {
    background: #fff;
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    max-width: 420px;
}

.unauth-box h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.unauth-box a {
    color: #2563eb;
}

/* ── LAYOUT ── */
.prg-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.prg-control-panel {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.75rem;
    align-items: start;
}

@media (max-width: 900px) {
    .prg-control-panel {
        grid-template-columns: 1fr;
    }
}

/* ── PANEL CARDS ── */
.prg-panel-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.prg-panel-title {
    font-family: 'DM Serif Text', Lato, Georgia, serif;
    font-size: 1.35rem;
    font-weight: 400;
    margin: 0 0 1.25rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eeeeee;
    width: 100%;
    text-align: center;
}

/* ── CONTROLS ── */
.prg-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.prg-control-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.prg-control-group label {
    font-weight: 600;
    font-size: 0.92rem;
    color: #333;
}

.prg-control-group.prg-inline-label {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.prg-control-group input[type="number"],
.prg-control-group input[type="text"] {
    font-size: 1rem;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid #d1d1d1;
    width: 100%;
    background: #fafafa;
    transition: border-color 0.2s;
}

.prg-control-group input[type="number"]:focus,
.prg-control-group input[type="text"]:focus {
    outline: none;
    border-color: #555;
}

.prg-control-group input[type="color"] {
    height: 44px;
    width: 100%;
    border-radius: 6px;
    border: 1px solid #d1d1d1;
    padding: 3px;
    cursor: pointer;
    background: #fafafa;
}

/* ── DROP ZONE (upload area) ── */
.prg-drop-zone {
    position: relative;
    border: 2px dashed #c0c0c0;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}

.prg-drop-zone:hover,
.prg-drop-zone.drag-over {
    border-color: #555;
    background: #f0f0f0;
}

.prg-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

#prg-dropLabel {
    font-size: 0.9rem;
    color: #555;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ── TOGGLE ── */
.prg-toggle-checkbox {
    width: 17px;
    height: 17px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── SLIDER ── */
.prg-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prg-value-slider {
    flex-grow: 1;
    cursor: pointer;
    accent-color: #333;
}

.prg-slider-value-display {
    width: 50px;
    text-align: right;
    font-size: 0.88rem;
    color: #555;
}

/* ── DIVIDERS & SECTION LABELS ── */
.prg-separator {
    border: none;
    border-top: 1px solid #f0f0f0;
    margin: 4px 0;
}

.prg-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 4px 0 0;
    color: #1a1a1a;
}

/* ── FALLBACK WARNING ── */
.prg-warning-text {
    font-size: 0.88rem;
    padding: 10px 12px;
    background: #fdf2f2;
    color: #b91c1c;
    border-radius: 6px;
    margin: 0 0 8px;
    line-height: 1.5;
}

/* ── CANVAS PANEL ── */

.prg-canvas-container {
    width: 100%;
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px dashed #cccccc;
    padding: 12px;
    min-height: 320px;
}

#prg-gridCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.prg-canvas-placeholder-text {
    position: absolute;
    color: #999;
    font-size: 0.95rem;
    text-align: center;
    margin: 0;
    pointer-events: none;
}

/* ── GRID INFO ── */
.prg-grid-info-text {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    margin: 0.75rem 0 0;
    min-height: 18px;
    line-height: 1.5;
}

/* ── EXPORT BUTTON ── */
.prg-export-btn {
    margin-top: 1rem;
    padding: 0.8rem 2rem;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: #111111;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.01em;
}

.prg-export-btn:hover:not(:disabled) {
    background: #333333;
    transform: translateY(-2px);
}

.prg-export-btn:disabled {
    background: #c0c5c9;
    cursor: not-allowed;
    transform: none;
}
