/* Historical Ciphers lesson styles */

/* ── Pigpen ── */
.pigpen-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 1.5rem 0;
}

.pigpen-grid-wrapper {
    text-align: center;
}

.pigpen-grid-wrapper h4 {
    margin-bottom: 0.5rem;
    color: #2c5aa0;
    font-size: 0.95rem;
}

.pigpen-grid,
.pigpen-x {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    gap: 2px;
}

.pigpen-x {
    grid-template-columns: repeat(2, 52px);
}

.pigpen-ref-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px;
    gap: 2px;
}

.pigpen-ref-cell span {
    font-size: 0.75rem;
    font-weight: bold;
    color: #4a90e2;
    font-family: monospace;
}

.pigpen-symbol {
    display: block;
}

/* Encoder output */
.pigpen-output {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-height: 60px;
    margin-top: 0.5rem;
}

.pigpen-symbol-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pigpen-symbol-wrapper span {
    font-size: 0.7rem;
    font-weight: bold;
    color: #666;
    font-family: monospace;
}

/* ── Polybius ── */
.polybius-container {
    margin: 1.5rem 0;
    overflow-x: auto;
}

.polybius-square {
    display: inline-block;
}

.poly-row {
    display: flex;
}

.poly-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 500;
    background: white;
}

.poly-cell.header {
    background: #4a90e2;
    color: white;
    font-weight: bold;
}

.poly-cell.corner {
    background: #2c5aa0;
}

.poly-cell:hover:not(.header):not(.corner) {
    background: #e3f2fd;
    cursor: default;
}

/* ── Atbash ── */
.atbash-table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.atbash-table {
    display: inline-block;
    min-width: 100%;
}

.atbash-row {
    display: flex;
    align-items: center;
}

.atbash-label {
    width: 60px;
    font-weight: bold;
    font-size: 0.85rem;
    color: #555;
    flex-shrink: 0;
    padding-right: 0.5rem;
}

.atbash-cell {
    width: 30px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 500;
    background: #f8f9fa;
}

.atbash-cell.cipher {
    background: #fde8e8;
    color: #c0392b;
    border-top: none;
}

/* ── Shared interactive demo result ── */
.result {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    font-family: monospace;
    font-size: 1rem;
    min-height: 44px;
    word-break: break-all;
}

.hint-text {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
}

/* ── History note ── */
.history-note {
    background: #fff9e6;
    border-left: 4px solid #ffa500;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.history-note h3 {
    color: #cc8400;
    margin-top: 0;
    font-size: 1rem;
}

/* ── Comparison table ── */
.comparison-table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
}

.comparison-table th {
    background: #4a90e2;
    color: white;
    font-weight: bold;
}

.comparison-table tr:nth-child(even) {
    background: #f8f9fa;
}

.comparison-table tr:hover {
    background: #e3f2fd;
}

/* ── Button group ── */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.btn-small.secondary {
    background: #6c757d;
}

.btn-small.secondary:hover {
    background: #5a6268;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .pigpen-grid {
        grid-template-columns: repeat(3, 44px);
    }

    .poly-cell {
        width: 38px;
        height: 38px;
        font-size: 0.85rem;
    }

    .atbash-cell {
        width: 24px;
        height: 28px;
        font-size: 0.75rem;
    }

    .atbash-label {
        width: 50px;
    }
}
