/* Styl dla Tabeli Gematrycznej */
.gematria-table-wrapper {
    margin: 20px auto;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.gematria-table-wrapper.align-left {
    justify-content: flex-start;
}

.gematria-table-wrapper.align-center {
    justify-content: center;
}

.gematria-table-wrapper.align-right {
    justify-content: flex-end;
}

.gematria-table {
    border-collapse: collapse;
    border: 2px solid #000;
    width: auto;
    min-width: 200px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.gematria-table th,
.gematria-table td {
    border: 1px solid grey;
    padding: 8px 12px;
    text-align: center;
    min-width: 50px;
}

.gematria-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    border-bottom: 2px solid #000;
}

.gematria-table .letter-cell {
    font-weight: bold;
    background-color: #fafafa;
}

.gematria-table .word-cell {
    font-weight: bold;
    background-color: #fafafa;
    text-align: left;
    min-width: 120px;
    white-space: nowrap;
}

.gematria-table .last-input-row td {
    border-bottom: 2px solid #000;
}

.gematria-table .sum-row td,
.gematria-table .digit-sum-row td,
.gematria-table .reduction-row td {
    background-color: #f0f0f0;
}

.gematria-table .special-number {
    color: #800000;
    font-weight: bold;
}

.gematria-table .master-number {
    color: #228B22;
    font-weight: bold;
}

/* Tryb słów - frontend */
.gematria-table-wrapper.word-mode .gematria-table {
    min-width: 300px;
}

/* Style dla edytora */
.gematria-editor-wrapper {
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gematria-editor-wrapper.align-left {
    align-items: flex-start;
}

.gematria-editor-wrapper.align-center {
    align-items: center;
}

.gematria-editor-wrapper.align-right {
    align-items: flex-end;
}

.gematria-editor-table {
    border-collapse: collapse;
    border: 2px solid #000;
    width: auto;
    min-width: 200px;
}

.gematria-editor-table th,
.gematria-editor-table td {
    border: 1px solid grey;
    padding: 8px 12px;
    text-align: center;
    min-width: 50px;
}

.gematria-editor-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    border-bottom: 2px solid #000;
}

.gematria-editor-table .letter-input {
    width: 40px;
    height: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.gematria-editor-table .word-input {
    width: 150px;
    height: 30px;
    text-align: left;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0 8px;
}

.gematria-editor-table .letter-input:focus,
.gematria-editor-table .word-input:focus {
    outline: 2px solid #007cba;
    border-color: #007cba;
}

.gematria-editor-table .letter-input.invalid,
.gematria-editor-table .word-input.invalid {
    background-color: #ffe0e0;
    border-color: #cc0000;
    text-decoration: underline;
    text-decoration-color: red;
}

.gematria-editor-table .input-cell {
    position: relative;
}

.gematria-editor-table .input-cell.has-error::before {
    content: "*";
    color: red;
    font-weight: bold;
    position: absolute;
    top: 2px;
    right: 5px;
    font-size: 14px;
}

.gematria-editor-table .last-input-row td {
    border-bottom: 2px solid #000;
}

.gematria-editor-table .sum-row td,
.gematria-editor-table .digit-sum-row td,
.gematria-editor-table .reduction-row td {
    background-color: #f0f0f0 !important;
}

.gematria-editor-table .special-number {
    color: #800000;
    font-weight: bold;
}

.gematria-editor-table .master-number {
    color: #228B22;
    font-weight: bold;
}

.gematria-error-message {
    color: red;
    font-size: 13px;
    margin-top: 10px;
}

.gematria-error-message::before {
    content: "* ";
    font-weight: bold;
}

.gematria-controls {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gematria-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.gematria-controls input[type="number"] {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.gematria-controls .mode-indicator {
    color: #666;
    font-size: 12px;
    font-style: italic;
    margin-left: 10px;
}

/* Tryb słów w edytorze */
.gematria-editor-wrapper.word-mode .gematria-editor-table {
    min-width: 350px;
}

.gematria-editor-wrapper.word-mode .input-cell {
    min-width: 160px;
}

/* Responsywność - tablet */
@media screen and (max-width: 768px) {
    .gematria-table,
    .gematria-editor-table {
        min-width: 180px;
        font-size: 14px;
    }
    
    .gematria-table th,
    .gematria-table td,
    .gematria-editor-table th,
    .gematria-editor-table td {
        padding: 6px 8px;
        min-width: 40px;
    }
    
    .gematria-editor-table .letter-input {
        width: 35px;
        height: 28px;
        font-size: 14px;
    }
    
    .gematria-editor-table .word-input {
        width: 120px;
        height: 28px;
        font-size: 13px;
    }
    
    .gematria-table .word-cell {
        min-width: 100px;
    }
    
    .gematria-table-wrapper.word-mode .gematria-table,
    .gematria-editor-wrapper.word-mode .gematria-editor-table {
        min-width: 280px;
    }
}

/* Responsywność - telefon */
@media screen and (max-width: 480px) {
    .gematria-table-wrapper {
        margin: 10px auto;
        padding: 0 5px;
    }
    
    .gematria-table,
    .gematria-editor-table {
        min-width: auto;
        width: 100%;
        font-size: 12px;
    }
    
    .gematria-table th,
    .gematria-table td,
    .gematria-editor-table th,
    .gematria-editor-table td {
        padding: 4px 3px;
        min-width: 30px;
    }
    
    .gematria-editor-table .letter-input {
        width: 28px;
        height: 26px;
        font-size: 12px;
        padding: 2px;
    }
    
    .gematria-editor-table .word-input {
        width: 90px;
        height: 26px;
        font-size: 11px;
        padding: 2px 4px;
    }
    
    .gematria-table .word-cell {
        min-width: 80px;
        font-size: 11px;
    }
    
    .gematria-controls {
        padding: 8px;
        font-size: 13px;
    }
    
    .gematria-controls input[type="number"] {
        width: 55px;
        padding: 4px 6px;
    }
    
    .gematria-error-message {
        font-size: 11px;
    }
    
    .gematria-table-wrapper.word-mode .gematria-table,
    .gematria-editor-wrapper.word-mode .gematria-editor-table {
        min-width: auto;
    }
    
    .gematria-editor-wrapper.word-mode .input-cell {
        min-width: 100px;
    }
}

/* Bardzo małe ekrany - kompaktowy widok */
@media screen and (max-width: 360px) {
    .gematria-table,
    .gematria-editor-table {
        font-size: 11px;
    }
    
    .gematria-table th,
    .gematria-table td,
    .gematria-editor-table th,
    .gematria-editor-table td {
        padding: 3px 2px;
        min-width: 25px;
    }
    
    .gematria-editor-table .letter-input {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .gematria-editor-table .word-input {
        width: 70px;
        height: 24px;
        font-size: 10px;
    }
    
    .gematria-table .word-cell {
        min-width: 60px;
        font-size: 10px;
    }
}
