/* =============================================
   Loveroom Gift Card — Card Builder UI
   ============================================= */

/* Reset for builder context */
.lgc-builder *,
.lgc-builder *::before,
.lgc-builder *::after {
    box-sizing: border-box;
}

/* Error state */
.lgc-error {
    max-width: 500px;
    margin: 80px auto;
    text-align: center;
    padding: 40px;
    background: #fef2f2;
    border-radius: 12px;
    border: 1px solid #fecaca;
}

.lgc-error h2 {
    color: #991b1b;
    margin: 0 0 10px;
}

.lgc-error p {
    color: #7f1d1d;
    margin: 0;
}

/* Header — golden title */
.lgc-builder__header {
    text-align: center;
    padding: 40px 20px 20px;
}

.lgc-builder__header h1 {
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 12px;
    background: linear-gradient(135deg, #f5c842, #d4a843, #c8923c, #f5d060);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 0.5px;
}

.lgc-builder__subtitle {
    color: #9ca3af;
    font-size: 16px;
    margin: 0;
}

/* ===========================================
   NEW LAYOUT: Preview on top, options below
   =========================================== */

.lgc-builder__layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Preview: full width on top */
.lgc-builder__preview-wrapper {
    width: 100%;
}

.lgc-sticky-preview {
    position: static;
}

.lgc-preview-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    margin: 0 0 12px;
    text-align: center;
}

/* Card preview — centered, max width */
#lgc-preview {
    max-width: 700px;
    margin: 0 auto;
}

/* Controls: grid below the preview */
.lgc-builder__controls {
    width: 100%;
}

/* Options grid — all sections side by side */
.lgc-builder__controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Control sections */
.lgc-control-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
}

.lgc-control-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Actions bar — full width at the bottom */
.lgc-control-section.lgc-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Reservation info */
.lgc-reservation-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lgc-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.lgc-info-row:last-child {
    border-bottom: none;
}

.lgc-info-label {
    color: #9ca3af;
    font-size: 13px;
}

.lgc-info-value {
    color: #1f2937;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
}

/* Template grid */
.lgc-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.lgc-template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.lgc-template-btn:hover {
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.lgc-template-btn.active {
    border-color: #d4a843;
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.2);
}

.lgc-template-swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: block;
}

.lgc-template-name {
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    line-height: 1.2;
}

/* Textarea */
.lgc-textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
}

.lgc-textarea:focus {
    outline: none;
    border-color: #d4a843;
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
}

.lgc-char-count {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.lgc-char-separator {
    opacity: 0.5;
}

/* Dropzone */
.lgc-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.lgc-dropzone:hover,
.lgc-dropzone.dragover {
    border-color: #d4a843;
    background: rgba(212, 168, 67, 0.05);
}

.lgc-dropzone.has-photo {
    border-style: solid;
    padding: 8px;
}

.lgc-dropzone-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.lgc-dropzone-content p {
    margin: 0 0 4px;
    color: #6b7280;
    font-size: 13px;
}

.lgc-dropzone-hint {
    color: #9ca3af;
    font-size: 11px;
}

.lgc-dropzone-preview {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.lgc-remove-photo {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #dc2626;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Font list — horizontal for compact layout */
.lgc-font-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lgc-font-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    text-align: left;
    transition: all 0.2s;
}

.lgc-font-btn:hover {
    border-color: #d1d5db;
}

.lgc-font-btn.active {
    border-color: #d4a843;
    background: rgba(212, 168, 67, 0.06);
}

/* Colors */
.lgc-color-row {
    display: flex;
    gap: 20px;
}

.lgc-color-row label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.lgc-color-row span {
    font-size: 13px;
    color: #6b7280;
}

.lgc-color-row input[type="color"] {
    -webkit-appearance: none;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    width: 40px;
    height: 36px;
    padding: 2px;
    cursor: pointer;
}

.lgc-color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.lgc-color-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* Buttons */
.lgc-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
    text-align: center;
}

.lgc-btn--primary {
    background: linear-gradient(135deg, #d4a843 0%, #c8923c 100%);
    color: #fff;
}

.lgc-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.3);
}

.lgc-btn--secondary {
    background: #f3f4f6;
    color: #374151;
}

.lgc-btn--secondary:hover {
    background: #e5e7eb;
}

.lgc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Save indicator (auto-save feedback) */
.lgc-save-indicator {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 4px;
    transition: opacity 0.3s;
}

.lgc-save-indicator--saving {
    color: #92400e;
    background: #fef3c7;
}

.lgc-save-indicator--saved {
    color: #065f46;
    background: #ecfdf5;
}

.lgc-save-indicator--error {
    color: #991b1b;
    background: #fef2f2;
}

/* Status messages */
.lgc-status {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    margin-top: 10px;
    display: none;
    width: 100%;
}

.lgc-status--success {
    display: block;
    background: #ecfdf5;
    color: #065f46;
}

.lgc-status--error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

/* Large screens: 3 columns */
@media (min-width: 1024px) {
    .lgc-builder__controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium screens: 2 columns */
@media (max-width: 1023px) and (min-width: 640px) {
    .lgc-builder__controls {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small screens: single column */
@media (max-width: 639px) {
    .lgc-builder__controls {
        grid-template-columns: 1fr;
    }

    .lgc-builder__header h1 {
        font-size: 30px;
    }

    .lgc-template-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .lgc-control-section.lgc-actions {
        flex-direction: column;
    }

    .lgc-btn {
        width: 100%;
    }
}
