/* Reset podstawowy */
body, h1, h2, h3, p, table, input, button, select {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
}

/* Body */
body {
    background-color: #f9f9f9;
    color: #333;
    padding: 20px;
}

/* Nagłówki */
h1, h2 {
    margin-bottom: 20px;
    color: #444;
}

/* Główny formularz wyboru kategorii */
form.main-form {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    max-width: 500px;
    margin-bottom: 30px;
}

form.main-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

form.main-form input[type="text"],
form.main-form input[type="number"],
form.main-form select {
    width: 100%;
    height: 45px;
    min-height: 45px;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.3;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

form.main-form input[type="text"]:focus,
form.main-form input[type="number"]:focus,
form.main-form select:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
    outline: none;
}

/* Przyciski w głównym formularzu */
form.main-form button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background-color 0.3s;
}

form.main-form button:hover {
    background-color: #218838;
}

/* Mini formularze w tabeli (np. przycisk Status) */
td form {
    all: unset;
    display: inline;
}

/* Tabele */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background-color: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    word-wrap: break-word;
}

table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #f2f2f2;
}

table tr:hover {
    background-color: #e9f5ff;
}

/* Kontener przycisków w jednej komórce tabeli */
td .button-group {
    display: flex;
    flex-direction: column; /* przyciski jeden pod drugim */
    row-gap: 6px; /* odstęp między przyciskami */
    align-items: flex-start; /* naturalna szerokość przycisków */
}

/* Wszystkie przyciski w button-group */
td .button-group > button {
    display: inline-block; /* flex-item */
    width: auto; /* naturalna szerokość */
    min-width: 80px; /* minimalna szerokość */
    text-align: center;
    margin: 0; /* usuwa marginesy blokujące odstęp */
}

/* Przycisk "Słowo" */
button.speak-button {
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s, transform 0.1s;
    color: white;
}

/* Status = 0 (niebieski) */
button.speak-button.status-0 {
    background-color: #007bff;
}
button.speak-button.status-0:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}
button.speak-button.status-0:active {
    background-color: #00408d;
    transform: scale(0.98);
}

/* Status = 1 (pomarańczowy) */
button.speak-button.status-1 {
    background-color: #fd7e14;
}
button.speak-button.status-1:hover {
    background-color: #e06b0b;
    transform: scale(1.05);
}
button.speak-button.status-1:active {
    background-color: #b35808;
    transform: scale(0.98);
}

/* Status = 2 (zielony) */
button.speak-button.status-2 {
    background-color: #28a745;
}
button.speak-button.status-2:hover {
    background-color: #218838;
    transform: scale(1.05);
}
button.speak-button.status-2:active {
    background-color: #1e7e34;
    transform: scale(0.98);
}

/* Przycisk "Status" w tabeli – zawsze czerwony */
button.status-button {
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s, transform 0.1s;
    color: white;
    background-color: #dc3545;
}
button.status-button:hover {
    background-color: #c82333;
    transform: scale(1.05);
}
button.status-button:active {
    background-color: #a71d2a;
    transform: scale(0.98);
}

/* Przycisk "Zdanie" – teraz czerwony jak Status */
button.sentence-button {
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: white;
    background-color: #dc3545;
    transition: background-color 0.3s, transform 0.1s;
}
button.sentence-button:hover {
    background-color: #c82333;
    transform: scale(1.05);
}
button.sentence-button:active {
    background-color: #a71d2a;
    transform: scale(0.98);
}

/* Komunikaty o błędach i sukcesie */
p {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

p[style*="color: green"] {
    background-color: #d4edda;
    color: #155724;
}

p[style*="color: red"] {
    background-color: #f8d7da;
    color: #721c24;
}

/* Modal */
#sentenceModal {
    display: none; /* domyślnie ukryty */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    display: none; /* wyłączone przy starcie */
}

#sentenceModalContent {
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    max-width: 90%;
    text-align: center;
    font-size: 1.2em;
    line-height: 1.4em;
}

#sentenceModalContent button {
    margin-top: 15px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #444;
    cursor: pointer;
    margin-left: 6px;
    background: #f5f5f5;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
}
#sentenceModalContent button:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}
#sentenceModalContent button:active {
    transform: scale(0.98);
}

/* Responsywność */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    form.main-form {
        width: 100%;
        padding: 15px;
    }
}

/* Dodatkowa stylizacja strzałki w select (opcjonalnie) */
form.main-form select::-ms-expand {
    display: block; /* IE/Edge */
}
