/* CSS Variables - Color Palette */
:root {
    --cream: #fef3c7;
    --red: #b91c1c;
    --brown: #78350f;
    --yellow: #fde047;
    --white: #ffffff;
    --black: #1a1a1a;
}

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

body {
    background-color: var(--cream);
    color: var(--brown);
    font-family: 'Courier Prime', monospace;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, .coupon-offer, .coupon-suboffer {
    font-family: 'Rokkitt', serif;
    font-weight: 900;
    color: var(--black);
    line-height: 1.1;
}

.logo, .coupon-logo {
    font-family: 'Caveat', cursive;
    color: var(--red);
    font-size: 2.5rem;
    line-height: 1;
    transform: rotate(-2deg);
    display: inline-block;
}

.hidden {
    display: none !important;
}

/* Layout */
.layout-wrapper {
    display: flex;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(120, 53, 15, 0.1);
    background-color: #fdf8e7; /* slightly lighter cream for paper effect */
}

/* Side Strip */
.side-strip {
    flex: 0 0 200px;
    border-right: 2px solid var(--brown);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(120, 53, 15, 0.05) 2px,
        rgba(120, 53, 15, 0.05) 4px
    );
}

.strip-image {
    width: 100%;
    aspect-ratio: 1/1;
    border: 3px solid var(--brown);
    background-color: var(--white);
    padding: 5px;
    transform: rotate(calc(-2deg + (var(--i, 0) * 4deg)));
    transition: transform 0.3s ease;
}

.strip-image:nth-child(even) { --i: 1; }
.strip-image:nth-child(odd) { --i: 0; }
.strip-image:hover { transform: rotate(0deg) scale(1.05); }

.strip-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: sepia(0.3) contrast(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
}

.header-area {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--brown);
    padding-bottom: 20px;
}

.header-area h1 {
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
}

.header-area h2 {
    font-size: 2rem;
    color: var(--red);
    font-weight: 700;
}

/* Action Areas (Form / Success) */
.action-area {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(253, 224, 71, 0.3); /* Yellow tint */
    padding: 20px;
    border-radius: 8px;
    border: 1px dashed rgba(120, 53, 15, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.entry-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

input[type="email"] {
    flex: 1;
    padding: 12px 15px;
    font-family: inherit;
    font-size: 1rem;
    border: 2px solid var(--brown);
    background: var(--white);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="email"]:focus {
    border-color: var(--red);
}

button {
    padding: 12px 24px;
    font-family: 'Rokkitt', serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    background-color: var(--red);
    color: var(--white);
    border: 2px solid var(--brown);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background-color: var(--brown);
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.print-button {
    background-color: var(--brown);
}
.print-button:hover {
    background-color: var(--red);
}

.success-text {
    color: var(--red);
}

.error-msg, .status-msg {
    color: var(--red);
    font-weight: bold;
    margin-top: 10px;
    text-align: center;
}
.status-msg {
    font-size: 1.5rem;
    padding: 20px;
    background: rgba(255,255,255,0.8);
    border: 2px solid var(--red);
    margin-bottom: 20px;
}

/* The Coupon */
.coupon-wrapper {
    position: relative;
    margin: 20px auto;
    width: 100%;
    max-width: 600px;
}

.scissors-icon {
    position: absolute;
    top: -12px;
    left: 20px;
    font-size: 1.5rem;
    color: var(--red);
    background: #fdf8e7; /* Match layout wrapper */
    padding: 0 5px;
    z-index: 2;
    transform: rotate(90deg);
}

.the-coupon {
    background-color: var(--white);
    border: 4px dashed var(--red);
    padding: 6px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.coupon-inner {
    border: 1px solid var(--brown);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    /* Perforation effect simulation */
    background-image: radial-gradient(circle at 0 50%, transparent 8px, var(--white) 9px), radial-gradient(circle at 100% 50%, transparent 8px, var(--white) 9px);
    background-position: left, right;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.coupon-header {
    margin-bottom: 20px;
    width: 100%;
}

.coupon-logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

.coupon-offer {
    font-size: 5rem;
    color: var(--black);
    letter-spacing: -2px;
    margin: 0;
    text-shadow: 2px 2px 0 var(--yellow);
}

.coupon-suboffer {
    font-size: 1.2rem;
    letter-spacing: 3px;
    border-top: 2px solid var(--black);
    border-bottom: 2px solid var(--black);
    padding: 5px 0;
    margin-top: -10px;
    background: var(--yellow);
    color: var(--black);
}

.coupon-body {
    width: 100%;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.barcode-container {
    background: rgba(120, 53, 15, 0.05);
    padding: 10px 20px;
    border-radius: 4px;
    width: 100%;
}

.barcode-font {
    font-family: 'Libre Barcode 39', cursive;
    font-size: 60px;
    line-height: 1;
    color: var(--black);
    transition: filter 0.3s;
}

.code-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 5px;
    transition: filter 0.3s, opacity 0.3s;
}

.blurred {
    filter: blur(5px);
    opacity: 0.5;
    user-select: none;
}

.coupon-meta {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--red);
    border: 2px solid var(--red);
    padding: 5px 15px;
    border-radius: 99px;
}

.coupon-footer {
    width: 100%;
    margin-top: 10px;
}

.disclaimer {
    font-family: 'Courier Prime', monospace;
    font-size: 0.65rem;
    color: #666;
    line-height: 1.4;
    text-align: justify;
    text-align-last: center;
}

/* Store Info / Footer */
.footer-info {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--brown);
    display: flex;
    justify-content: space-between;
    text-align: center;
    font-size: 0.9rem;
}

.info-block strong {
    font-family: 'Rokkitt', serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: var(--red);
}

#wbx-powered-by-slot {
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 800px) {
    .layout-wrapper {
        flex-direction: column;
    }
    
    .side-strip {
        flex-direction: row;
        border-right: none;
        border-bottom: 2px solid var(--brown);
        padding: 15px;
        overflow-x: auto;
    }
    
    .strip-image {
        width: 100px;
        flex: 0 0 auto;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .header-area h1 { font-size: 2.2rem; }
    .header-area h2 { font-size: 1.5rem; }
    .coupon-offer { font-size: 3.5rem; }
    
    .entry-form {
        flex-direction: column;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .coupon-inner { padding: 15px; }
    .coupon-offer { font-size: 2.8rem; text-shadow: 1px 1px 0 var(--yellow); }
    .coupon-suboffer { font-size: 0.9rem; letter-spacing: 1px; }
    .barcode-font { font-size: 40px; }
}

/* Print Styles - Crucial for a Printable Coupon */
@media print {
    body, .layout-wrapper {
        background: white !important;
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
    
    .side-strip, .header-area, #form-area, #success-area, .footer-info, #wbx-powered-by-slot, .scissors-icon {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
        display: block;
    }
    
    .coupon-wrapper {
        margin: 0;
        max-width: 100%;
    }
    
    .the-coupon {
        border: 2px dashed #000 !important; /* High contrast for B&W printers */
        box-shadow: none;
    }
    
    .coupon-inner {
        border: 1px solid #000;
        background-image: none !important; /* Remove gradients for clean print */
    }
    
    .coupon-logo, .coupon-offer, .coupon-suboffer, .coupon-meta, .code-text, .barcode-font, .disclaimer {
        color: #000 !important;
        text-shadow: none !important;
    }
    
    .coupon-suboffer {
        background: transparent !important;
        border-color: #000 !important;
    }
    
    .coupon-meta {
        border-color: #000 !important;
    }
    
    /* Force page break avoidance */
    .coupon-wrapper {
        page-break-inside: avoid;
    }
}