/**
 * Wedding Site - Form Builder / Dashboard design
 * Scoped with [data-design="4"] on the body (set in base.html).
 *
 * Design 4: Coral Garden (coral/yellow, pill labels)
 *
 * Candidate designs 1, 2, 3 and 5 were dropped on 2026-08-08;
 * the full pre-removal file is kept at
 * docs/archive/design-candidates/form_builder_designs.candidates.css
 */

/* ================================
   FONT IMPORTS
   ================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Dancing+Script:wght@500;600;700&display=swap');

/* ================================
   DESIGN 4: CORAL GARDEN
   Coral/yellow palette, pill labels
   ================================ */
body[data-design="4"] {
    --fb-coral: #ff7b7b;
    --fb-coral-dark: #e05656;
    --fb-coral-light: #ffe5e5;
    --fb-yellow: #ffd54f;
    --fb-yellow-light: #fff9e6;
    --fb-cream: #fffbf8;
    --fb-text: #4a4040;
    --fb-text-light: #7a6a6a;
    --fb-label: #e05656;
    --fb-label-bg: #fff0f0;

    font-family: 'Poppins', -apple-system, sans-serif;
    font-weight: 400;
    background: linear-gradient(180deg, var(--fb-cream) 0%, var(--fb-coral-light) 100%);
    min-height: 100vh;
}

body[data-design="4"] .nav {
    background: rgba(255, 251, 248, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--fb-coral);
}

body[data-design="4"] .nav-brand {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--fb-coral);
}

body[data-design="4"] h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--fb-text);
}

body[data-design="4"] h2,
body[data-design="4"] h3,
body[data-design="4"] .card-title,
body[data-design="4"] .section-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--fb-text);
}

body[data-design="4"] .card {
    background: #fff;
    border: 2px solid var(--fb-coral-light);
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(255, 123, 123, 0.08);
}

body[data-design="4"] .card:hover {
    box-shadow: 0 8px 28px rgba(255, 123, 123, 0.14);
}

/* FIELD LABELS - pill style */
body[data-design="4"] .form-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--fb-label);
    background: var(--fb-label-bg);
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    margin-bottom: 10px;
}

body[data-design="4"] .form-input,
body[data-design="4"] .form-select,
body[data-design="4"] .form-textarea {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--fb-text);
    border: 2px solid #f0e0e0;
    border-radius: 12px;
    padding: 12px 16px;
}

body[data-design="4"] .form-input:focus,
body[data-design="4"] .form-select:focus,
body[data-design="4"] .form-textarea:focus {
    border-color: var(--fb-coral);
    box-shadow: 0 0 0 3px var(--fb-coral-light);
}

/* BUTTONS */
body[data-design="4"] .btn-primary {
    background: linear-gradient(145deg, #ff8585 0%, #ff6b6b 40%, #e85858 100%);
    border: none;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow:
        0 6px 20px rgba(255, 107, 107, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    padding: 12px 26px;
}

body[data-design="4"] .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.5);
}

body[data-design="4"] .btn-secondary {
    background: linear-gradient(145deg, #ffe066 0%, #ffd54f 50%, #f5c400 100%);
    border: none;
    color: #5a4a00;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 50px;
    padding: 10px 24px;
    box-shadow: 0 4px 14px rgba(255, 213, 79, 0.4);
}

body[data-design="4"] .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 213, 79, 0.5);
}

body[data-design="4"] .btn-ghost {
    background: transparent;
    border: none;
    color: var(--fb-coral);
    font-weight: 500;
}

body[data-design="4"] .section-item {
    border: 2px solid var(--fb-coral-light);
    border-radius: 14px;
}

body[data-design="4"] .badge-success {
    background: rgba(255, 213, 79, 0.2);
    color: #e65100;
}

body[data-design="4"] .badge-info {
    background: var(--fb-coral-light);
    color: var(--fb-coral-dark);
}

body[data-design="4"] .lang-switcher a.active {
    background: var(--fb-coral);
}

body[data-design="4"] .footer {
    background: var(--fb-text);
}

/* ================================
   FORM CARDS - Dashboard Layout
   ================================ */
.form-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 20px 24px;
}

.form-card__content {
    flex: 1;
    min-width: 0;
}

.form-card__header {
    margin-bottom: 12px;
}

.form-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: inherit;
}

.form-card__slug {
    font-size: 0.8rem;
    color: var(--fb-text-light, #888);
    font-family: monospace;
}

.form-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.form-card__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ================================
   TAG SYSTEM
   ================================ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.04);
    color: #666;
    white-space: nowrap;
}

.tag svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.tag__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag__dot--active {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.tag__dot--pending {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.tag__dot--inactive {
    background: #ef4444;
    opacity: 0.6;
}

/* Tag variants */
.tag--date {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
}

.tag--active {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.tag--pending {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.tag--inactive {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
}

.tag--sheets.tag--connected {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.tag--sheets.tag--disconnected {
    background: rgba(0, 0, 0, 0.04);
    color: #999;
}

/* Sheet is configured but unreachable -- RSVPs are being lost right now, so this
   reads as an alarm rather than as the muted "not set up yet" state. */
.tag--sheets.tag--error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.tag--sheets.tag--error svg {
    opacity: 1;
}

.sheet-alert {
    margin-top: var(--space-2, 8px);
    padding: 10px 14px;
    border-left: 3px solid #ef4444;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.07);
    color: #7f1d1d;
    font-size: 0.85rem;
    line-height: 1.5;
}

.sheet-alert a {
    color: #b91c1c;
    font-weight: 600;
    white-space: nowrap;
}

/* ================================
   UNIFIED BUTTON BASE
   ================================ */
/* Base button styles for consistency */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

/* Remove btn-sm - all buttons same size */
.btn-sm {
    font-size: 0.8rem;
    padding: 10px 20px;
}

/* btn-danger base */
.btn-danger {
    background: linear-gradient(145deg, #ff7070 0%, #ef4444 40%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(239, 68, 68, 0.4);
}


/* ================================
   DESIGN-SPECIFIC TAG COLORS
   ================================ */
body[data-design="4"] .tag--date {
    background: rgba(100, 181, 246, 0.12);
    color: #1976d2;
}

body[data-design="4"] .tag--active {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

body[data-design="4"] .tag--inactive {
    background: var(--fb-coral-light);
    color: #a05050;
}

body[data-design="4"] .tag--sheets.tag--connected {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

body[data-design="4"] .tag--sheets.tag--disconnected {
    background: rgba(255, 213, 79, 0.15);
    color: #b07a00;
}

body[data-design="4"] .tag--sheets.tag--error {
    background: rgba(224, 86, 86, 0.14);
    color: #b03030;
}

body[data-design="4"] .btn-danger {
    background: linear-gradient(145deg, #ff9090 0%, #ff6b6b 40%, #e05050 100%);
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
}

/* ================================
   SECTION ITEMS - Form Builder
   ================================ */
.section-item {
    padding: 16px 20px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.section-reorder {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.section-info {
    flex: 1;
    min-width: 0;
}

/* Section title row - title and edit button horizontally aligned */
.section-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.section-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    line-height: inherit;
    margin: 0;
}

.section-title-input {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 4px 10px;
    width: 220px;
    max-width: 100%;
    border-radius: 6px;
}

.section-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
    font-size: 0.85rem;
    line-height: 1;
    height: auto;
    vertical-align: middle;
    flex-shrink: 0;
}

.section-title-row:hover .section-edit-btn {
    opacity: 0.7;
}

.section-edit-btn:hover {
    opacity: 1;
}

/* Section tags row - left aligned with title */
.section-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
    padding-left: 0;
}

.section-tags .badge {
    font-size: 0.65rem;
    padding: 3px 10px;
}

/* Section meta row */
.section-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
}

.section-per-guest-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--fb-text-light, #888);
    cursor: pointer;
}

.section-per-guest-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

/* Section actions */
.section-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: flex-start;
}

/* ================================
   RESPONSIVE - FORM CARDS
   ================================ */
@media (max-width: 768px) {
    .form-card {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .form-card__actions {
        justify-content: flex-start;
    }

    /* Invitation card - constrain to viewport on mobile */
    .template-preview-container {
        max-width: calc(100vw - 120px);
    }

    .invitation-card {
        height: auto !important;
        max-height: none !important;
        width: 100%;
    }

    /* Google Sheets - prevent overflow */
    [data-testid="sheets-config-section"] .card-body code {
        word-break: break-all;
        overflow-wrap: anywhere;
    }

    [data-testid="sheets-config-section"] .card-body .flex.items-center.gap-4 {
        flex-wrap: wrap;
        gap: 8px;
    }

    [data-testid="connection-status"] {
        padding-right: 8px;
    }

    /* Section items - stack layout on mobile */
    .section-item {
        padding: 12px 12px;
    }

    .section-item .section-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .section-item .section-reorder {
        flex-direction: column;
        gap: 0;
    }

    .section-item .section-reorder .btn {
        padding: 0 4px;
        min-width: 24px;
        min-height: 20px;
        font-size: 0.75rem;
        line-height: 1;
    }

    .section-item .section-actions {
        width: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Editor header - wrap on mobile so title gets own line */
    .editor-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }

    .editor-header h1 {
        order: 2;
        flex-basis: 100%;
        font-size: 1.5rem;
    }

    .editor-header .btn:first-child {
        order: 1;
    }

    .editor-header .btn:last-child {
        order: 1;
        margin-left: auto;
    }
}

/* ================================
   TRANSITIONS
   ================================ */
body[data-design] .nav,
body[data-design] .card,
body[data-design] .btn,
body[data-design] .section-item,
body[data-design] .form-input,
body[data-design] .form-select,
body[data-design] .form-textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ================================
   MOBILE LAYOUT FIXES
   ================================ */
/* The dashboard used to force the document to ~474px on a 390px viewport: the
   form card's four action buttons sat in a non-wrapping row, and flex children
   default to min-width:auto so nothing could shrink. The page then scrolled
   sideways and the header/footer bars stopped short of the content. */
.form-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2, 8px);
}

.form-card,
.form-card__content,
.form-card__header {
    min-width: 0;
}

.form-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2, 8px);
}

.form-card__title {
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    /* Equal-width action buttons read better than four ragged ones. */
    .form-card__actions .btn {
        flex: 1 1 calc(50% - var(--space-2, 8px));
        justify-content: center;
    }
}

/* Editor field rows: label, type badge, "Upraviť" and "x" were all printing on
   top of each other on a phone. .field-info is flex-1 but could still be
   crushed to ~22px because a flex item will not shrink below its content
   unless min-width is cleared -- and the two button columns took priority. */
.field-item {
    flex-wrap: wrap;
}

.field-item .field-info {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .field-item .field-info {
        /* Give the label its own full-width row, actions underneath. */
        flex: 1 1 100%;
        order: 1;
    }

    .field-item .field-reorder {
        order: 0;
        /* Side by side rather than stacked -- two arrows in a column made every
           field row about 40px taller than it needed to be. */
        flex-direction: row;
    }

    .field-item .field-actions {
        order: 2;
        margin-left: auto;
    }
}
