/* 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;
    line-height: 1.6;
    color: #1e293b;
    background: linear-gradient(to bottom right, #f8fafc, #eff6ff);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Language Selector */
.language-selector {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.lang-select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: #475569;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 150px;
}

.lang-select:hover {
    border-color: #2563eb;
}

.lang-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: #64748b;
}

/* Settings Card */
.settings-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 3rem;
}

.settings-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input[type="number"],
.form-group textarea,
.form-group select,
.form-select {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
    background-color: white;
}

.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.help-text {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #2563eb;
}

.checkbox-label span {
    color: #475569;
    font-size: 0.9375rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(to right, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    width: 100%;
}

.btn-primary:hover {
    background: linear-gradient(to right, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Bingo Cards Container */
#cardsContainer {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* Individual Bingo Card */
.bingo-card {
    background: transparent;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    page-break-after: always;
    page-break-inside: avoid;
    break-after: page;
    break-inside: avoid;
}

/* Bingo Grid */
.bingo-grid {
    display: grid;
    gap: 0;
    border: 2px solid #000;
    background: #000;
    margin: 0 auto;
}

/* Bingo Canvas */
.bingo-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Bingo Cells */
.bingo-cell {
    background: white;
    border: 1px solid #000;
    padding: 1rem;
    min-height: 100px;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    font-weight: 500;
    color: #000;
}

.bingo-cell.free-space {
    background: white;
    font-weight: 700;
    font-size: 1.25em;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: #64748b;
    font-size: 0.875rem;
}

.footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .settings-card {
        padding: 1.5rem;
    }

    .bingo-cell {
        padding: 0.5rem;
        min-height: 80px;
        font-size: 0.85em;
    }
}

/* Print Styles - Minimal Ink Usage */
@media print {
    @page {
        size: A4 portrait;
        margin: 5mm;
    }

    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        background: white;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .language-selector,
    .header,
    .settings-card,
    .footer {
        display: none !important;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #cardsContainer {
        gap: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    .bingo-card {
        position: relative !important;
        width: 100% !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        padding: 5mm !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        page-break-before: always !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        break-before: page !important;
        break-after: page !important;
        break-inside: avoid !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        background: white !important;
    }

    /* First card should not have page break before */
    .bingo-card:first-child {
        page-break-before: auto !important;
        break-before: auto !important;
    }

    /* Last card should not create extra blank page */
    .bingo-card:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* Force black and white for print to save ink */
    .bingo-grid {
        border: 1px solid black !important;
        background: white !important;
        max-width: 100% !important;
    }

    .bingo-cell {
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
        padding: 0.5rem !important;
        min-height: 70px !important;
        font-size: 0.9rem !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .bingo-cell.free-space {
        background: white !important;
        color: black !important;
        font-weight: 700 !important;
    }

    /* Canvas rendering for print */
    .bingo-canvas {
        display: block !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
    }
}

/* Print button could be added if needed */
@media screen {
    .print-hint {
        text-align: center;
        color: #64748b;
        font-size: 0.875rem;
        margin-top: 1rem;
        font-style: italic;
    }
}
