:root {
    --primary-color: #e74c3c;
    --secondary-color: #2c3e50;
    --accent-color: #3498db;
    --background-color: #f4f6f7;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #ddd;
    --preview-bg: #fdfbf7;
    --receipt-font: 'Courier Prime', 'Courier New', monospace;
}

[data-theme="dark"] {
    --primary-color: #e74c3c;
    --secondary-color: #ecf0f1;
    --accent-color: #85c1e9;
    /* Lighter blue for dark mode */
    --background-color: #1a1a1a;
    --text-color: #eee;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --preview-bg: #e0dace;
}

/* Global Link Styles */
a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

/* Header */
header {
    background-color: var(--card-bg);
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.mode-toggle {
    cursor: pointer;
    font-size: 20px;
}

/* Ad Spaces */
.ad-slot {
    width: 100%;
    min-height: 90px;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    color: #999;
    border: 1px dashed #ccc;
    font-size: 14px;
}

/* Main Layout */
.tool-section {
    display: flex;
    width: 100%;
    gap: 30px;
}

.input-column {
    flex: 1;
    min-width: 300px;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.preview-column {
    width: 380px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.preview-container {
    background-color: var(--preview-bg);
    padding: 30px;
    border: 1px solid #d3d3d3;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    font-family: var(--receipt-font);
    color: #000;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

/* Texture overlay for paper effect */
/* Templates Configuration */

/* Common Overlay for Paper Texture (Optional, applied to all or specific) */
.preview-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/textures/texture1.jpg');
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
}

/* Template 1: Sawtooth / Zig-Zag Edges */
/* Template 1: Sawtooth / Zig-Zag Edges */
/* Template 1: Sawtooth / Zig-Zag Edges */
/* Template 1: Sawtooth / Zig-Zag Edges */
.template-1 {
    position: relative;
    border: none !important;
    box-shadow: none !important;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
    margin: 15px 0;
    background: #fafafa;
    /* Slightly different from pure white */
}

/* Texture support for Template 1 needs inner container or specific handling, 
   but for now we focus on the cut effect */

/* Top Zig-Zag - "Cutting" the top by overlaying background color */
.template-1::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 15px;
    /* Deeper cut */
    background: linear-gradient(135deg, var(--background-color) 33.333%, transparent 33.333%),
        linear-gradient(225deg, var(--background-color) 33.333%, transparent 33.333%);
    background-size: 20px 20px;
    /* Larger teeth */
    background-position: 0 0;
    z-index: 10;
}

/* Bottom Zig-Zag */
.template-1::after {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    /* Deeper cut */
    background: linear-gradient(45deg, var(--background-color) 33.333%, transparent 33.333%),
        linear-gradient(-45deg, var(--background-color) 33.333%, transparent 33.333%);
    background-size: 20px 20px;
    /* Larger teeth */
    background-position: 0 0;
    z-index: 10;
}

/* Template 2: Side Watermarks (Bank Strips) */
.template-2 {
    border: none;
    position: relative;
    padding-right: 40px;
    /* Space for strip */
    /* background: #fff; Removed for thermal texture */
}

.template-2 .receipt-logo {
    filter: none;
    /* Show original color for this template */
}

.template-2::after {
    content: "HDFC BANK   HDFC BANK   HDFC BANK";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: #e8f4f8;
    color: #3498db;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    opacity: 1;
    z-index: 5;
    border-left: 1px dashed #ccc;
    overflow: hidden;
    white-space: nowrap;
}

/* Template 3: Classic Thermal (Simple Border) */
.template-3 {
    border: 1px solid #ccc;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.receipt-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    box-sizing: border-box;
}

.checkbox-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.section-title {
    margin-top: 25px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 18px;
    color: var(--primary-color);
}

/* Receipt Styles */
.receipt-header {
    margin-bottom: 20px;
    border-bottom: 1px dashed #000;
    padding-bottom: 15px;
}

.receipt-logo {
    max-width: 150px;
    margin-bottom: 10px;
    filter: grayscale(100%) contrast(120%);
    /* Thermal printer look */
}

.receipt-title {
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    margin: 5px 0;
}

.receipt-address {
    font-size: 12px;
    margin-bottom: 10px;
}

.receipt-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 5px;
}

.receipt-body {
    margin: 20px 0;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.receipt-row.total {
    border-top: 1px dashed #000;
    border-bottom: 1px dashed #000;
    padding: 10px 0;
    margin: 15px 0;
    font-weight: bold;
    font-size: 16px;
}

.receipt-footer {
    border-top: 1px dashed #000;
    padding-top: 15px;
    font-size: 10px;
    margin-top: 20px;
}

/* Actions */
.actions-panel {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
    flex: 1;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-warning {
    background-color: #f1c40f;
    color: #333;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

/* Responsive */
@media (max-width: 900px) {
    .tool-section {
        flex-direction: column;
    }

    .preview-column {
        width: 100%;
        position: static;
        margin-top: 30px;
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    .preview-container,
    .preview-container * {
        visibility: visible;
    }

    .preview-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 80mm;
        /* Standard thermal paper width approx */
        margin: 0;
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
    }

    /* Ensure no margins on page */
    @page {
        margin: 0;
    }
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-nav a:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.main-nav a.active,
.main-nav a.active:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary-color);
    padding: 5px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 15px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 12px 12px;
        z-index: 1000;
        border-top: 1px solid var(--border-color);
    }

    .main-nav.active {
        display: block;
        animation: slideDown 0.3s ease-out forwards;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 15px;
    }

    .main-nav a {
        justify-content: flex-start;
        padding: 12px 20px;
        border-radius: 8px;
        background-color: var(--background-color);
    }

    .main-nav a:hover {
        background-color: var(--primary-color);
        color: white;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}