/**
 * Hestia Cake Builder - Frontend Styles
 */

/* ============================================
   CSS Variables & Base
   ============================================ */
.hcb-cake-builder {
    --hcb-primary: #243F2C;
    --hcb-primary-light: #2d5038;
    --hcb-accent: #B39590;
    --hcb-accent-light: #E1BDB8;
    --hcb-blush: #FDF8F6;
    --hcb-cream: #FFFDF7;
    --hcb-text: #1a1a1a;
    --hcb-text-muted: #6b7280;
    --hcb-border: #e5e5e5;
    --hcb-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --hcb-shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.05);
    --hcb-radius: 16px;
    --hcb-radius-sm: 10px;
    --hcb-transition: all 0.25s ease;
    
    font-family: 'Century Gothic', 'Avenir', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--hcb-text);
    line-height: 1.6;
}

/* ============================================
   Layout Grid
   ============================================ */
.hcb-builder-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 1024px) {
    .hcb-builder-grid {
        grid-template-columns: 2fr 1fr;
        gap: 2.5rem;
        padding: 2rem;
    }
}

/* ============================================
   Cards & Sections
   ============================================ */
.hcb-card {
    background: #ffffff;
    border-radius: var(--hcb-radius);
    padding: 1.5rem;
    box-shadow: var(--hcb-shadow-soft);
    border: 1px solid var(--hcb-border);
}

@media (min-width: 768px) {
    .hcb-card {
        padding: 2rem;
    }
}

.hcb-section {
    margin-bottom: 1.5rem;
}

.hcb-section-title {
    font-family: 'Made Canvas', 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--hcb-primary);
    margin: 0 0 1.5rem 0;
}

/* ============================================
   Form Fields
   ============================================ */
.hcb-field-group {
    margin-bottom: 1.5rem;
}

.hcb-field-group:last-child {
    margin-bottom: 0;
}

.hcb-label {
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--hcb-text);
    margin-bottom: 0.5rem;
}

.hcb-label .required {
    color: var(--hcb-accent);
}

.hcb-label .optional {
    font-weight: 400;
    color: var(--hcb-text-muted);
    font-size: 0.85rem;
}

.hcb-field-description {
    font-size: 0.85rem;
    color: var(--hcb-text-muted);
    margin: 0 0 0.5rem 0;
}

.hcb-field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .hcb-field-row {
        grid-template-columns: 1fr 1fr;
    }
}

.hcb-field-half {
    width: 100%;
}

/* ============================================
   Option Buttons
   ============================================ */
.hcb-options {
    display: grid;
    gap: 0.75rem;
}

.hcb-options-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

.hcb-options-4 {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
    .hcb-options-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hcb-options-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.hcb-option {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border: 2px solid var(--hcb-border);
    border-radius: var(--hcb-radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--hcb-text);
    cursor: pointer;
    transition: var(--hcb-transition);
    text-align: center;
    line-height: 1.3;
}

.hcb-option:hover {
    border-color: var(--hcb-accent);
    background: var(--hcb-blush);
}

.hcb-option[data-selected="true"] {
    border-color: var(--hcb-primary);
    background: var(--hcb-accent-light);
    color: var(--hcb-primary);
    font-weight: 500;
}

.hcb-option .hcb-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Checkbox style options */
.hcb-checkbox-options .hcb-option {
    position: relative;
}

.hcb-option[data-disabled="true"] {
    opacity: 0.9;
    cursor: default;
}

.hcb-option-default {
    font-size: 0.75rem;
    color: var(--hcb-text-muted);
    margin-left: 0.25rem;
}

.hcb-addon-price {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 400;
    color: #999;
    line-height: 1;
    margin-top: 0;
}

.hcb-option[data-selected="true"] .hcb-addon-price {
    color: var(--hcb-primary);
    opacity: 0.7;
}

/* ============================================
   Input Fields
   ============================================ */
.hcb-input-wrapper {
    position: relative;
}

.hcb-input-icon .hcb-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--hcb-text-muted);
    pointer-events: none;
}

.hcb-input-icon .hcb-input {
    padding-left: 2.75rem;
}

.hcb-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border: 2px solid var(--hcb-border);
    border-radius: var(--hcb-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--hcb-text);
    transition: var(--hcb-transition);
    box-sizing: border-box;
}

.hcb-input:focus {
    outline: none;
    border-color: var(--hcb-primary);
    box-shadow: 0 0 0 3px rgba(36, 63, 44, 0.1);
}

.hcb-textarea {
    width: 100%;
    padding: 1rem;
    background: #ffffff;
    border: 2px solid var(--hcb-border);
    border-radius: var(--hcb-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--hcb-text);
    resize: vertical;
    min-height: 120px;
    transition: var(--hcb-transition);
    box-sizing: border-box;
}

.hcb-textarea:focus {
    outline: none;
    border-color: var(--hcb-primary);
    box-shadow: 0 0 0 3px rgba(36, 63, 44, 0.1);
}

.hcb-textarea::placeholder {
    color: var(--hcb-text-muted);
}

/* ============================================
   Upload Area
   ============================================ */
.hcb-upload-area {
    border: 2px dashed var(--hcb-border);
    border-radius: var(--hcb-radius-sm);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--hcb-transition);
    background: var(--hcb-blush);
}

.hcb-upload-area * {
    pointer-events: none;
}

.hcb-upload-area:hover {
    border-color: var(--hcb-accent);
    background: var(--hcb-cream);
}

.hcb-upload-area.dragover {
    border-color: var(--hcb-primary);
    background: var(--hcb-accent-light);
}

.hcb-upload-icon {
    width: 40px;
    height: 40px;
    color: var(--hcb-text-muted);
    margin-bottom: 0.75rem;
}

.hcb-upload-text {
    font-size: 0.95rem;
    color: var(--hcb-text);
    margin: 0 0 0.25rem 0;
}

.hcb-upload-hint {
    font-size: 0.8rem;
    color: var(--hcb-text-muted);
    margin: 0;
}

.hcb-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hcb-upload-preview:empty {
    display: none;
}

.hcb-upload-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.hcb-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hcb-upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

/* ============================================
   Preview Column
   ============================================ */
.hcb-preview-column {
    order: -1;
}

@media (min-width: 1024px) {
    .hcb-preview-column {
        order: 0;
    }
}

.hcb-preview-card {
    background: var(--hcb-blush);
    border-radius: var(--hcb-radius);
    padding: 1.5rem;
    box-shadow: var(--hcb-shadow-soft);
    border: 1px solid var(--hcb-border);
}

@media (min-width: 768px) {
    .hcb-preview-card {
        padding: 2rem;
    }
}

.hcb-sticky {
    position: relative;
}

@media (min-width: 1024px) {
    .hcb-sticky {
        position: sticky;
        top: 2rem;
    }
}

.hcb-preview-title {
    font-family: 'Made Canvas', 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--hcb-primary);
    margin: 0 0 0.25rem 0;
    text-align: center;
}

.hcb-preview-subtitle {
    font-size: 0.85rem;
    color: var(--hcb-text-muted);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* ============================================
   Cake SVG Visual
   ============================================ */
.hcb-cake-visual {
    aspect-ratio: 1;
    max-width: 280px;
    margin: 0 auto 1.5rem;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
}

.hcb-cake-svg {
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
}

/* ============================================
   Summary Section
   ============================================ */
.hcb-summary {
    border-top: 1px solid var(--hcb-border);
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.hcb-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.hcb-summary-label {
    color: var(--hcb-text-muted);
}

.hcb-summary-value {
    font-weight: 500;
    color: var(--hcb-text);
    text-align: right;
    max-width: 60%;
}

/* ============================================
   Badges
   ============================================ */
.hcb-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.hcb-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.hcb-badge-gf {
    background: var(--hcb-primary);
    color: white;
}

.hcb-badge-dietary {
    background: var(--hcb-accent-light);
    color: var(--hcb-primary);
}

/* ============================================
   Price Section
   ============================================ */
.hcb-price-section {
    background: white;
    border-radius: var(--hcb-radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
}

.hcb-price-breakdown {
    margin-bottom: 0.75rem;
}

.hcb-price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    color: var(--hcb-text-muted);
}

.hcb-price-row-value {
    font-weight: 500;
}

.hcb-price-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 2px solid var(--hcb-border);
}

.hcb-price-total-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--hcb-text);
}

.hcb-price-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hcb-primary);
}

/* ============================================
   Submit Button
   ============================================ */
.hcb-submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--hcb-primary);
    border: none;
    border-radius: var(--hcb-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--hcb-transition);
}

.hcb-submit-btn:hover {
    background: var(--hcb-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 63, 44, 0.3);
}

.hcb-submit-btn:active {
    transform: translateY(0);
}

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

.hcb-submit-btn.loading .hcb-btn-text {
    opacity: 0;
}

.hcb-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: hcb-spin 0.8s linear infinite;
}

@keyframes hcb-spin {
    to { transform: rotate(360deg); }
}

.hcb-submit-btn.success {
    background: #16a34a;
}

.hcb-btn-icon {
    width: 20px;
    height: 20px;
}

.hcb-submit-note {
    font-size: 0.8rem;
    color: var(--hcb-text-muted);
    text-align: center;
    margin: 1rem 0 0 0;
}

/* Mobile submit button */
.hcb-submit-mobile {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

@media (min-width: 1024px) {
    .hcb-submit-mobile {
        display: none;
    }
}

.hcb-mobile-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.hcb-mobile-price-label {
    font-weight: 500;
    color: var(--hcb-text-muted);
}

.hcb-mobile-price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--hcb-primary);
}

/* Hide desktop button on mobile */
.hcb-submit-btn-preview {
    display: none;
}

@media (min-width: 1024px) {
    .hcb-submit-btn-preview {
        display: flex;
    }
}

/* Add padding at bottom on mobile for fixed button */
@media (max-width: 1023px) {
    .hcb-cake-builder {
        padding-bottom: 100px;
    }
}

/* ============================================
   Animations
   ============================================ */
.hcb-fade-in {
    animation: hcb-fadeIn 0.3s ease;
}

@keyframes hcb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast notification */
.hcb-toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hcb-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--hcb-radius-sm);
    box-shadow: var(--hcb-shadow);
    z-index: 1000;
    animation: hcb-toastIn 0.3s ease;
}

@media (min-width: 1024px) {
    .hcb-toast {
        bottom: 2rem;
    }
}

@keyframes hcb-toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.hcb-toast.success {
    background: #16a34a;
}

.hcb-toast.error {
    background: #dc2626;
}

.hcb-toast a {
    color: white;
    text-decoration: underline;
    margin-left: 0.5rem;
}
