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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #a8c5e6 0%, #c1d9f0 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #e8e8e8;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 20px solid #1e3c72;
}

/* Header */
header {
    background: white; /* White header to match tan container */
    padding: 30px 20px;
    text-align: center;
    border-bottom: 3px solid #1e3c72; /* Blue border */
}

.logo {
    max-width: 400px;
    width: 100%;
    height: auto;
}

main {
    padding: 40px 30px;
    background: #e8e8e8;
}

h1 {
    color: #2d3748;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    color: #718096;
    text-align: center;
    margin-bottom: 40px;
    font-size: 16px;
}

/* Form Groups */
.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 15px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

/* Skinnier date inputs */
.form-group input[type="date"] {
    max-width: 220px;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    color: #718096;
    margin-top: 6px;
    font-size: 13px;
}

/* Age Display */
.age-result {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 8px;
    padding: 15px;
    color: #166534;
    font-size: 16px;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 150px;
    position: relative;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-option span {
    display: block;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s;
    background: white;
}

.radio-option input[type="radio"]:checked + span {
    background: #1e3c72; /* Blue when selected */
    color: white;
    border-color: #1e3c72;
}

.radio-option:hover span {
    border-color: #1e3c72;
}

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

.theme-tab {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-tab:hover {
    border-color: #1e3c72;
}

.theme-tab.active {
    background: #1e3c72; /* Blue when active */
    color: white;
    border-color: #1e3c72;
}

/* Template Gallery */
.template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.template-item {
    position: relative;
    cursor: pointer;
    border: 3px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.template-item:hover {
    border-color: #1e3c72;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
}

.template-item.selected {
    border-color: #1e3c72;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.2);
}

.template-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.template-item .template-name {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    background: #f8f9fa;
}

.template-item .checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #1e3c72; /* Blue checkmark */
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.template-item.selected .checkmark {
    display: flex;
}

/* Border Options */
.border-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.border-option {
    cursor: pointer;
    position: relative;
}

.border-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.border-option img {
    width: 100%;
    border: 3px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s;
    display: block;
}

.border-option span {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-weight: 500;
    color: #4a5568;
}

.border-option input[type="radio"]:checked ~ img {
    border-color: #1e3c72;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.2);
}

.border-option:hover img {
    border-color: #1e3c72;
}

/* Border checkmark - same style as template checkmark */
.border-option .checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #1e3c72; /* Blue checkmark */
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    z-index: 5;
}

.border-option input[type="radio"]:checked ~ .checkmark {
    display: flex;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 16px 30px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); /* Blue gradient */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.5);
}

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

/* Error Message */
.error-message {
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    padding: 15px;
    color: #c33;
    margin-top: 20px;
    font-weight: 500;
}

/* Footer */
footer {
    background: white;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
}

/* Browse Custom Options Button */
.browse-custom-btn {
    display: inline-block;
    padding: 10px 24px;
    background: white;
    color: #1e3c72;
    border: 2px solid #1e3c72;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.browse-custom-btn:hover {
    background: #1e3c72;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
}

/* ========================================
   CAROUSEL PREVIEW STYLES
   ======================================== */

.carousel-preview-container {
    margin-top: 25px;
    position: relative;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.preview-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
}

.preview-slide.active {
    opacity: 1;
    pointer-events: auto;
}

/* Navigation Arrows */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #1e3c72; /* Blue arrows */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    z-index: 10;
}

.carousel-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-nav.prev {
    left: 20px;
}

.carousel-nav.next {
    right: 20px;
}

/* Slide Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.2);
}

/* Photo Slide Preview - Clean, no border */
.preview-photo-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.preview-sample-photo {
    max-width: 80%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: none;
    border: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    main {
        padding: 30px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .logo {
        max-width: 280px;
    }

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

    .theme-tabs {
        flex-direction: column;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-option {
        min-width: 100%;
    }

    .border-options {
        grid-template-columns: 1fr;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .carousel-nav.prev {
        left: 10px;
    }

    .carousel-nav.next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .template-gallery {
        grid-template-columns: 1fr;
    }

    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* Dropdown Button Styles */
.dropdown-btn {
    width: 100%;
    padding: 16px 20px;
    background: white;
    color: #1e3c72;
    border: 2px solid #1e3c72;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    position: relative;
}

.dropdown-btn:hover {
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.2);
}

.dropdown-btn:after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: transform 0.3s;
}

.dropdown-btn.active:after {
    transform: translateY(-50%) rotate(180deg);
}

.dropdown-btn.selected {
    background: #e8f4ff;
    border-color: #1e3c72;
}

/* OR divider for background type radio buttons */
.radio-group-with-divider {
    display: flex;
    align-items: center;
    gap: 15px;
}

.radio-group-with-divider .radio-option {
    flex: 1;
    min-width: 150px;
}

.radio-group-with-divider .divider {
    color: #718096;
    font-weight: 600;
    font-size: 16px;
    padding: 0 10px;
}
