/* Base Reset & Variables */
:root {
    --primary: #C20F2F; /* Brand Red */
    --primary-hover: #a00c26;
    --secondary: #F5A706; /* Brand Orange */
    --accent: #683A0A; /* Brand Brown */
    --bg-color: #fffaf7; /* Warm tint background */
    --text-main: #000000;
    --text-light: #333333;
    --card-bg: #ffffff;
    --border: rgba(104, 58, 10, 0.15); /* Brown tinted border */
    --border-active: #C20F2F;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-main);
    line-height: 1.2;
    font-weight: 800;
}

/* Supplemental typography */
.form-subtitle, .terms-note, .input-group input, .input-group select, .input-group label, .action-box p {
    font-family: 'Open Sans', sans-serif;
}

.hidden {
    display: none !important;
}

/* Layout */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 60px;
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 100px 20px 80px;
    text-align: center;
    margin-bottom: -40px; /* Overlap with content */
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(rgba(255, 250, 247, 0.85), rgba(255, 250, 247, 0.98)), url('https://offertabs.s3.amazonaws.com/offer/y8gk8u/site/media/69eb6757cbfc36.17481308.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(194, 15, 47, 0.1);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #000000;
    letter-spacing: -0.02em;
}

.highlight {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 550px;
    margin: 0 auto;
}

/* Gallery Container */
.gallery-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.gallery-header h2 {
    font-size: 1.75rem;
}

#selection-counter {
    font-weight: 600;
    color: var(--primary);
    background: rgba(194, 15, 47, 0.1);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
}

/* Grid Layout */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Custom Checkbox Cards */
.design-item {
    cursor: pointer;
    display: block;
    user-select: none;
    position: relative;
}

.design-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.card-content {
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative; /* important for checkmark positioning */
}

/* Checkmark Icon Overlay */
.checkmark-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    box-shadow: 0 2px 5px rgba(194, 15, 47, 0.3);
    color: #ffffff;
}

.checkmark-icon svg {
    width: 14px;
    height: 14px;
}

/* Uploaded Image styling */
.design-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.design-item:hover .design-img {
    transform: scale(1.1);
}

/* SVG fallback icon styling */
.design-icon {
    width: 48px;
    height: 48px;
    color: var(--accent);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.design-item:hover .design-icon {
    transform: scale(1.1);
    color: var(--secondary);
}

.design-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: color 0.2s ease;
}

/* Selection States */
.design-item:hover .card-content {
    border-color: rgba(245, 167, 6, 0.6);
    background: rgba(245, 167, 6, 0.02);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.design-item input:checked ~ .card-content {
    border-color: var(--primary);
    background: rgba(194, 15, 47, 0.08); /* slight brand color background tint */
    box-shadow: 0 0 0 1px var(--primary); /* subtle extra border weight */
    transform: translateY(0);
}

.design-item input:checked ~ .card-content .checkmark-icon {
    opacity: 1;
    transform: scale(1);
}

.design-item input:checked ~ .card-content .design-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.design-item input:checked ~ .card-content .design-label {
    color: var(--primary);
}

/* Disabled State (when max selected) */
.design-item.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.design-item.disabled:hover .card-content {
    border-color: var(--border);
    background: #ffffff;
    transform: none;
    box-shadow: none;
}
.design-item.disabled:hover .design-icon,
.design-item.disabled:hover .design-img {
    transform: none;
}
.design-item.disabled:hover .design-icon {
    color: var(--accent);
}

/* Read-Only State (after clicking back to gallery) */
.read-only .design-item {
    cursor: default;
}
.read-only .design-item:hover .card-content {
    border-color: var(--border);
    background: #ffffff;
    transform: none;
    box-shadow: none;
}
.read-only .design-item:hover .design-img,
.read-only .design-item:hover .design-icon {
    transform: none;
}


/* Form Card */
.form-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-bottom: 40px;
}

.form-card h2 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.form-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 1.05rem;
}

.name-row {
    display: flex;
    gap: 16px;
    max-width: 400px;
    margin: 0 auto 24px;
}

.name-row .input-group {
    margin: 0;
    flex: 1;
}

.input-group {
    max-width: 400px;
    margin: 0 auto 24px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 1px solid rgba(104, 58, 10, 0.2);
    border-radius: 10px;
    background-color: #fafbfa;
    transition: all 0.2s ease;
}

.input-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23683A0A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(194, 15, 47, 0.1);
    background-color: #ffffff;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.btn {
    background: linear-gradient(135deg, var(--primary), #e52846);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-family: 'Montserrat', sans-serif;
    display: block;
    box-shadow: 0 4px 12px rgba(194, 15, 47, 0.2);
    flex: 2;
    margin: 0;
}

.btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(194, 15, 47, 0.3);
}

.btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-reset {
    background: #f3f4f6;
    color: var(--text-main);
    border: none;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    flex: 1;
    margin: 0;
}

.btn-reset:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.error-message {
    background: #fff0f0;
    color: var(--primary);
    padding: 14px;
    border-radius: 10px;
    margin: 0 auto 24px;
    max-width: 400px;
    font-size: 0.95rem;
    border: 1px solid rgba(194, 15, 47, 0.3);
    font-weight: 600;
}

/* Thank You View */
.success-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(194, 15, 47, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.success-card h2 {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.success-card > p {
    font-size: 1.15rem;
    color: var(--text-light);
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.steps-container {
    max-width: 600px;
    margin: 40px auto 0;
    text-align: left;
}

.steps-container h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--primary);
    text-align: center;
}

.action-box {
    background: rgba(245, 167, 6, 0.05);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(245, 167, 6, 0.3);
}

.step-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

.action-box h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--accent);
}

.action-box p {
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.action-box p:last-child {
    margin-bottom: 0;
}

.btn-secondary {
    display: inline-block;
    background: var(--secondary);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    text-align: center;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: #e59a05;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 167, 6, 0.3);
}

.share-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.share-btn {
    flex: 1;
    min-width: 140px;
    padding: 10px 16px;
    font-size: 0.95rem;
}

.back-link-container {
    margin-top: 32px;
    text-align: center;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-text:hover {
    color: var(--primary-hover);
}

#wbx-powered-by-slot {
    margin-top: auto;
    padding-top: 20px;
}

/* Lightbox Styles */
.view-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 3;
    transition: all 0.2s ease;
    color: var(--text-light);
}

.view-btn:hover, .view-btn:focus {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: scale(1.1);
    outline: none;
}

.view-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.lightbox-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 50px 30px 30px;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.05);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: var(--primary);
    color: white;
}

#lightbox-media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

#lightbox-media .design-img,
#lightbox-media .design-icon {
    max-width: 100%;
    max-height: 65vh;
    width: auto;
    height: auto;
    min-width: 250px;
    min-height: 250px;
    object-fit: contain;
    margin: 0;
    transform: none !important;
}

#lightbox-title {
    font-size: 1.5rem;
    color: var(--text-main);
    text-align: center;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 80px 20px 40px;
    }
    .hero h1 {
        font-size: 2.25rem;
    }
    .gallery-container {
        padding: 24px;
    }
    .gallery-header h2 {
        font-size: 1.4rem;
    }
    
    /* Strict 2-column mobile optimization */
    .emoji-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .card-content {
        padding: 16px 12px;
    }
    .form-card {
        padding: 30px 20px;
    }

    .name-row {
        flex-direction: column;
        gap: 24px;
    }

    .success-card {
        padding: 40px 20px;
    }
    .success-card h2 {
        font-size: 2rem;
    }
    
    /* Ensure inputs are easily tappable and don't trigger iOS auto-zoom */
    .input-group input, .input-group select {
        font-size: 16px;
        padding: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    .button-group .btn, .button-group .btn-reset {
        width: 100%;
        flex: none;
    }

    /* Thumb-friendly primary button */
    .btn {
        padding: 16px;
        min-height: 54px;
        font-size: 1.1rem;
    }
    
    /* Thumb-friendly secondary share buttons */
    .share-btn {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .lightbox-content {
        padding: 50px 20px 20px;
        width: 95vw;
    }
    #lightbox-media .design-img,
    #lightbox-media .design-icon {
        min-width: unset;
        min-height: unset;
        max-height: 50vh;
    }
    #lightbox-title {
        font-size: 1.25rem;
    }
}
