/* Frame Options */
.frame-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-frame {
    padding: 14px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.btn-frame:hover {
    border-color: #fc4c02;
}

.btn-frame.active {
    background: #fc4c02;
    border-color: #fc4c02;
    color: white;
    font-weight: 600;
}

/* Strava Art Builder 2.0 - Styles */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Montserrat:wght@600;700&family=Playfair+Display:wght@700&family=Raleway:wght@600&family=Lora:wght@600&family=Oswald:wght@600&family=Bebas+Neue&family=Merriweather:wght@700&family=Dancing+Script:wght@700&family=Pacifico&family=Great+Vibes&family=Sacramento&display=swap');

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Roboto', sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Main Layout */
.sav2-builder-wrapper {
    max-width: 100%;
    padding: 20px;
}

.sav2-container {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 40px;
    align-items: start;
}

/* Left Panel: Controls */
.sav2-controls {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    max-height: 90vh;
    overflow-y: auto;
}

.sav2-section {
    margin-bottom: 35px;
    padding-bottom: 35px;
    border-bottom: 1px solid #e5e5e5;
}

.sav2-section:last-of-type {
    border-bottom: none;
}

.sav2-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.sav2-section label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin: 15px 0 8px;
    color: #555;
}

.sav2-section input[type="text"],
.sav2-section input[type="file"],
.sav2-section select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
}

.sav2-section input[type="text"]:focus,
.sav2-section select:focus {
    outline: none;
    border-color: #fc4c02;
}

.help-text {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 20px 0;
}

/* Tabs */
.sav2-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.sav2-tab {
    flex: 1;
    padding: 12px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sav2-tab.active {
    background: #fc4c02;
    border-color: #fc4c02;
    color: white;
}

.sav2-tab-content {
    display: none;
}

.sav2-tab-content.active {
    display: block;
}

/* Strava Button */
.btn-strava {
    width: 100%;
    padding: 14px;
    background: #fc4c02;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-strava:hover {
    background: #e64402;
    transform: translateY(-1px);
}

.btn-strava svg {
    background: white;
    border-radius: 4px;
    padding: 2px;
}

/* Activities List */
#activities-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
}

.activity-item {
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.activity-item:hover {
    border-color: #fc4c02;
    background: #fff;
}

.activity-item.selected {
    border-color: #fc4c02;
    background: #fff5f3;
}

.activity-item strong {
    display: block;
    font-size: 15px;
    margin-bottom: 5px;
}

.activity-item span {
    font-size: 13px;
    color: #666;
    margin-right: 15px;
}

/* Button Groups */
.btn-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn-option {
    padding: 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-option:hover {
    border-color: #fc4c02;
}

.btn-option.active {
    background: #fc4c02;
    border-color: #fc4c02;
    color: white;
    font-weight: 600;
}

/* Shape Grid */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.shape-btn {
    padding: 8px 6px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.shape-btn:hover {
    border-color: #fc4c02;
}

.shape-btn.active {
    border-color: #fc4c02;
    background: #fff5f3;
}

.shape-preview {
    width: 30px;
    height: 30px;
    margin: 0 auto 6px;
    background: #e0e0e0;
}

.shape-preview.circle { border-radius: 50%; }
.shape-preview.square { border-radius: 0; }
.shape-preview.rectangle { width: 40px; height: 26px; border-radius: 0; }
.shape-preview.oval { width: 40px; height: 26px; border-radius: 50%; }
.shape-preview.heart { 
    position: relative;
    width: 30px;
    height: 28px;
    background: #e0e0e0;
    transform: rotate(-45deg);
    border-radius: 50% 50% 0 0;
}
.shape-preview.heart:before,
.shape-preview.heart:after {
    content: "";
    position: absolute;
    width: 30px;
    height: 28px;
    background: #e0e0e0;
    border-radius: 50%;
}
.shape-preview.heart:before {
    top: -14px;
    left: 0;
}
.shape-preview.heart:after {
    left: 14px;
    top: 0;
}
.shape-preview.star {
    background: transparent;
    position: relative;
    height: 30px;
}
.shape-preview.star:before {
    content: "★";
    font-size: 30px;
    color: #e0e0e0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.shape-preview.fullwidth { width: 100%; height: 30px; border-radius: 4px; }

.shape-btn span {
    display: block;
    font-size: 10px;
    color: #666;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    border-color: #fc4c02;
    background: #fff5f3;
}

#zoom-display {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* Color Palettes */
.color-palette {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    margin: 10px 0;
}

.color-palette-extended {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    margin: 10px 0;
}

.color-swatch {
    width: 100%;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.05);
}

.color-swatch.active {
    border-color: #fc4c02;
    transform: scale(1.08);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #fc4c02;
}

/* Range Slider */
input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.range-value {
    display: inline-block;
    width: 50px;
    text-align: right;
    font-size: 14px;
    font-weight: 500;
}

/* Checkboxes */
.checkbox-label {
    display: grid;
    grid-template-columns: 20px 1fr 120px 80px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.checkbox-label > span {
    font-size: 14px;
    font-weight: 500;
}

.stat-value {
    padding: 6px 10px !important;
    font-size: 13px !important;
}

.featured-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.featured-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.featured-text {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

/* Primary Button */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: #fc4c02;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 30px;
}

.btn-primary:hover:not(:disabled) {
    background: #e64402;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252,76,2,0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.price-note {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-top: 12px;
}

/* Right Panel: Preview */
.sav2-preview {
    position: sticky;
    top: 20px;
    text-align: center;
}

.preview-frame {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.print-container {
    background: white;
    margin: 0 auto;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s;
}

/* A4 Portrait: 210mm x 297mm at 96dpi ≈ 794px x 1123px */
.print-container.a4.portrait {
    width: 600px;
    height: 849px;
}

.print-container.a4.landscape {
    width: 849px;
    height: 600px;
}

/* Header */
.print-header {
    text-align: center;
    margin-bottom: 30px;
}

#preview-event-name {
    font-size: 36px;
    font-weight: 700;
    color: #000;
    margin-bottom: 10px;
    line-height: 1.2;
}

#preview-event-subtitle {
    font-size: 20px;
    font-weight: 400;
    color: #666;
    line-height: 1.3;
}

/* Map */
.map-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    min-height: 0;
}

.map-shape {
    width: 100%;
    max-width: 400px;
    max-height: 400px;
    aspect-ratio: 1;
    overflow: hidden;
    background: #e5e5e5;
    position: relative;
}

.map-shape.circle { border-radius: 50%; }
.map-shape.square { border-radius: 0; }
.map-shape.rectangle { 
    aspect-ratio: 4/3; 
    border-radius: 0;
    max-width: 450px;
    max-height: 340px;
}
.map-shape.oval { 
    aspect-ratio: 4/3; 
    border-radius: 50%;
    max-width: 450px;
    max-height: 340px;
}
.map-shape.heart {
    width: 400px;
    height: 400px;
    background: transparent;
}
.map-shape.heart #map-container {
    width: 100%;
    height: 100%;
    clip-path: path('M200,340 C200,340 60,240 60,160 C60,120 80,90 110,90 C135,90 160,105 200,145 C240,105 265,90 290,90 C320,90 340,120 340,160 C340,240 200,340 200,340 Z');
    filter: drop-shadow(0 0 0 1px #e0e0e0);
}
.map-shape.star {
    width: 400px;
    height: 400px;
    background: transparent;
}
.map-shape.star #map-container {
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    filter: drop-shadow(0 0 0 1px #e0e0e0);
}
.map-shape.fullwidth {
    aspect-ratio: 16/3;
    max-width: 100%;
    max-height: 120px;
    border-radius: 0;
}

.print-container.landscape .map-shape {
    max-width: 350px;
    max-height: 350px;
}

.print-container.landscape .map-shape.rectangle,
.print-container.landscape .map-shape.oval {
    max-width: 400px;
    max-height: 300px;
}

#map-container {
    width: 100%;
    height: 100%;
}

/* Footer */
.print-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.featured-stats {
    margin-bottom: 15px;
}

.featured-stats .stat-group {
    display: block;
    margin-bottom: 8px;
}

.featured-stats .stat-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.featured-stats .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.regular-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 12px;
}

.regular-stats .stat-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.regular-stats .stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.regular-stats .stat-value {
    font-size: 14px;
    font-weight: 700;
}

.print-footer .separator {
    margin: 0;
    color: #ccc;
}

.preview-label {
    margin-top: 20px;
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

/* Upload Status */
#upload-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

#upload-status.success {
    background: #d4edda;
    color: #155724;
}

#upload-status.error {
    background: #f8d7da;
    color: #721c24;
}

#upload-status.loading {
    background: #d1ecf1;
    color: #0c5460;
}

/* Font Classes */
.font-roboto { font-family: 'Roboto', sans-serif; }
.font-montserrat { font-family: 'Montserrat', sans-serif; }
.font-playfair { font-family: 'Playfair Display', serif; }
.font-raleway { font-family: 'Raleway', sans-serif; }
.font-lora { font-family: 'Lora', serif; }
.font-oswald { font-family: 'Oswald', sans-serif; }
.font-bebas { font-family: 'Bebas Neue', sans-serif; }
.font-merriweather { font-family: 'Merriweather', serif; }
.font-dancing { font-family: 'Dancing Script', cursive; }
.font-pacifico { font-family: 'Pacifico', cursive; }
.font-greatvibes { font-family: 'Great Vibes', cursive; }
.font-sacramento { font-family: 'Sacramento', cursive; }

/* Size Classes */
.size-xsmall { font-size: 12px; }
.size-small { font-size: 16px; }
.size-medium { font-size: 22px; }
.size-large { font-size: 32px; }
.size-xlarge { font-size: 44px; }

/* Floating Preview Button */
.floating-preview-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #fc4c02;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(252, 76, 2, 0.4);
    cursor: pointer;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.floating-preview-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(252, 76, 2, 0.5);
}

.floating-preview-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.preview-modal.active {
    display: flex;
}

.preview-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
}

.preview-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e5e5;
}

.preview-modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.preview-modal-close {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 24px;
    color: #666;
}

.preview-modal-close:hover {
    background: #fc4c02;
    color: white;
}

.preview-modal-body {
    display: flex;
    justify-content: center;
}

/* ============================================ */
/* MOCKUP-BASED PREVIEW SYSTEM - UPDATED */
/* ============================================ */

/* Mockup container */
.mockup-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Background mockup image */
.mockup-background {
    width: 100%;
    height: auto;
    display: block;
}

/* Print overlay container - NO WHITE BACKGROUND */
.mockup-print-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    overflow: visible;
}

/* UPDATED PROPORTIONS */

/* Unframed - increased by 124% width, 130% height */
.mockup-wrapper[data-mockup="unframed"] .mockup-print-overlay {
    width: 68.696%;
    padding-top: 105.56%;
}

/* Unframed with mount - increased by 124% width, 130% height */
.mockup-wrapper[data-mockup="unframed-mounted"] .mockup-print-overlay {
    width: 59.52%;
    padding-top: 97.5%;
}

/* White frame - increased by 124% width, 130% height */
.mockup-wrapper[data-mockup="framed-white-unmounted"] .mockup-print-overlay {
    width: 68.696%;
    padding-top: 105.56%;
}

/* White frame with mount - increased by 110% width, 111% height */
.mockup-wrapper[data-mockup="framed-white-mounted"] .mockup-print-overlay {
    width: 52.8%;
    padding-top: 83.25%;
}

/* Black frame - increased by 124% width, 130% height */
.mockup-wrapper[data-mockup="framed-black-unmounted"] .mockup-print-overlay {
    width: 68.696%;
    padding-top: 105.56%;
}

/* Black frame with mount - increased by 110% width, 111% height */
.mockup-wrapper[data-mockup="framed-black-mounted"] .mockup-print-overlay {
    width: 52.8%;
    padding-top: 83.25%;
}

/* The actual print content - TRANSPARENT BACKGROUND */
.mockup-print-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6% 5%;
    background: transparent;
}

/* Scale down all content proportionally */
.mockup-print-content .print-header {
    margin-bottom: 4%;
}

.mockup-print-content #preview-event-name {
    font-size: clamp(18px, 3vw, 32px);
    line-height: 1.2;
    margin-bottom: 1%;
}

.mockup-print-content #preview-event-subtitle {
    font-size: clamp(12px, 1.8vw, 18px);
    line-height: 1.3;
}

.mockup-print-content .map-wrapper {
    padding: 3% 0;
    flex: 1;
}

.mockup-print-content .map-shape {
    max-width: 100%;
    max-height: 100%;
}

.mockup-print-content .print-footer {
    margin-top: 4%;
    font-size: clamp(10px, 1.4vw, 14px);
}

.mockup-print-content .featured-stats .stat-value {
    font-size: clamp(16px, 2.5vw, 24px) !important;
}

.mockup-print-content .featured-stats .stat-label {
    font-size: clamp(8px, 1vw, 11px);
}

.mockup-print-content .regular-stats .stat-value {
    font-size: clamp(10px, 1.4vw, 14px);
}

.mockup-print-content .regular-stats .stat-label {
    font-size: clamp(7px, 0.9vw, 9px);
}

.mockup-print-content .separator {
    font-size: clamp(8px, 1.2vw, 12px);
}

/* Ensure map renders properly inside mockup */
.mockup-print-content #map-container {
    width: 100%;
    height: 100%;
}

.mockup-print-content .mapboxgl-canvas {
    width: 100% !important;
    height: 100% !important;
}

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

@media (max-width: 1400px) {
    .sav2-container {
        grid-template-columns: 400px 1fr;
        gap: 30px;
    }
    
    .print-container.a4.portrait {
        width: 500px;
        height: 707px;
    }
    
    .print-container.a4.landscape {
        width: 707px;
        height: 500px;
    }
    
    .mockup-wrapper {
        max-width: 500px;
    }
}

@media (max-width: 1100px) {
    .sav2-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sav2-preview {
        position: static;
    }
    
    .print-container.a4.portrait {
        width: 450px;
        height: 636px;
    }
    
    .print-container.a4.landscape {
        width: 636px;
        height: 450px;
    }
    
    .mockup-wrapper {
        max-width: 450px;
    }
    
    /* Show floating button on tablet and mobile */
    .floating-preview-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .sav2-builder-wrapper {
        padding: 15px;
    }
    
    .sav2-controls {
        padding: 20px;
        max-height: none;
    }
    
    .print-container.a4.portrait {
        width: 280px;
        height: 396px;
        padding: 30px 25px;
    }
    
    .print-container.a4.landscape {
        width: 396px;
        height: 280px;
        padding: 25px 30px;
    }
    
    .print-container.a4.portrait #preview-event-name {
        font-size: 24px;
    }
    
    .print-container.a4.landscape #preview-event-name {
        font-size: 20px;
    }
    
    .print-container #preview-event-subtitle {
        font-size: 14px;
    }
    
    .print-container .map-wrapper {
        padding: 15px 0;
    }
    
    .print-container .print-header {
        margin-bottom: 20px;
    }
    
    .print-container .print-footer {
        margin-top: 20px;
        font-size: 11px;
    }
    
    .color-palette {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .shape-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn-group {
        grid-template-columns: 1fr;
    }
    
    .checkbox-label {
        grid-template-columns: 20px 1fr;
        gap: 8px;
    }
    
    .stat-value {
        grid-column: 2;
        margin-top: 5px;
    }
    
    .featured-label {
        grid-column: 2;
        margin-top: 5px;
    }
    
    .map-shape {
        max-width: 220px;
        max-height: 220px;
    }
    
    .print-container.landscape .map-shape {
        max-width: 200px;
        max-height: 200px;
    }
    
    .mockup-wrapper {
        max-width: 350px;
    }
    
    .mockup-print-content {
        padding: 5% 4%;
    }
    
    .mockup-print-content #preview-event-name {
        font-size: clamp(14px, 4vw, 24px);
    }
    
    .mockup-print-content #preview-event-subtitle {
        font-size: clamp(10px, 2.5vw, 14px);
    }
}