/* style.css */
body {
    background-color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background-color: #2e7d32;
    color: white;
    padding: 20px 0;
    text-align: center;
    border-bottom: 5px solid #1b5e20;
}

header h1 {
    margin: 0;
    font-family: 'Georgia', serif;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

.logout-bar {
    background: #f8f9fa;
    padding: 10px 20px;
    text-align: right;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.logout-link {
    color: #d32f2f;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 3px;
    background-color: #fff;
    border: 1px solid #d32f2f;
}

.logout-link:hover {
    background-color: #d32f2f;
    color: white;
}

.container {
    width: 95%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Komunikaty */
.error-message {
    background: #f44336;
    color: white;
    padding: 12px;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
}

.success-message {
    background: #4caf50;
    color: white;
    padding: 12px;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
}

/* Strona główna */
.home-choice {
    text-align: center;
    margin-top: 50px;
}

.herb-img {
    max-width: 200px;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-main {
    display: inline-block;
    min-width: 200px;
    margin: 10px;
    padding: 15px 25px;
    background-color: #2e7d32;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
}

.btn-main:hover {
    background-color: #1b5e20;
    text-decoration: none;
}

.btn-small {
    padding: 8px 15px;
    font-size: 14px;
    min-width: auto;
}

.login-form {
    max-width: 400px;
    margin: 0 auto;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #2e7d32;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Formularz dodawania */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 20px;
}

.col {
    flex: 1;
    min-width: 300px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 5px rgba(46,125,50,0.3);
}

.input-with-button {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-with-button input {
    flex: 1;
    margin-bottom: 0;
}

.input-with-button button {
    white-space: nowrap;
}

.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

.age-status {
    padding: 12px;
    color: black;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

.age-adult { 
    background-color: #4CAF50; 
    color: white;
}
.age-teen { 
    background-color: #FFEB3B; 
    color: black;
}
.age-child { 
    background-color: #E040FB; 
    color: white;
}

/* Tabela */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

th {
    background-color: #2e7d32;
    color: white;
    padding: 15px 10px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s;
}

th:hover {
    background-color: #1b5e20;
}

td {
    border: 1px solid #e0e0e0;
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
}

/* Badge'y dla tabeli */
.age-badge, .byt-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    min-width: 80px;
}

.byt-pracuje { 
    background-color: #bbdefb; 
    color: #0d47a1; 
}
.byt-nauka { 
    background-color: #c8e6c9; 
    color: #1b5e20; 
}
.byt-emeryt { 
    background-color: #ffecb3; 
    color: #ff6f00; 
}
.byt-rencista { 
    background-color: #f8bbd0; 
    color: #880e4f; 
}

.status-alive {
    color: #2e7d32;
    font-weight: bold;
}

.status-dead {
    color: #d32f2f;
    font-weight: bold;
}

/* Przyciski akcji */
.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-action {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    transition: opacity 0.3s, transform 0.1s;
    min-width: 70px;
}

.btn-action:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.btn-view { background-color: #2e7d32; }
.btn-edit { background-color: #fbc02d; color: black; }
.btn-msg { background-color: #1976d2; }
.btn-del { background-color: #757575; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #aaa;
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

/* Zakładki */
.tabs {
    overflow: hidden;
    background-color: #f1f1f1;
    margin-bottom: 25px;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-wrap: wrap;
}

.tab-btn {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 20px;
    transition: 0.3s;
    font-size: 16px;
    font-weight: bold;
    flex: 1;
    min-width: 150px;
}

.tab-btn:hover {
    background-color: #ddd;
}

.tab-btn.active {
    background-color: #2e7d32;
    color: white;
}

.tab-content {
    display: none;
    padding: 20px;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Wyszukiwarka */
.search-container {
    text-align: center;
    padding: 20px;
}

.search-container h2 {
    color: #333;
    margin-bottom: 25px;
}

.search-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto 30px;
}

.search-box input {
    flex: 1;
    margin-bottom: 0;
    padding: 12px;
    font-size: 16px;
}

.search-box button {
    padding: 12px 25px;
    white-space: nowrap;
}

.search-result {
    text-align: left;
    margin-top: 30px;
}

/* Widok użytkownika */
.user-view-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Szczegóły użytkownika w modalu */
.user-details {
    padding: 15px 0;
}

.details-table {
    width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
}

.details-table td {
    padding: 10px;
    border: 1px solid #eee;
    text-align: left;
}

.details-table tr:hover {
    background-color: #f9f9f9;
}

/* Wiadomości */
.messages-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 5px;
    background: #fafafa;
}

.message-item {
    border-bottom: 1px solid #ddd;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: #666;
    font-size: 13px;
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
}

.no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.message-form {
    margin-bottom: 25px;
}

.message-form textarea {
    width: 100%;
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

/* Formularz edycji */
.edit-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.form-row.checkbox-row label {
    display: inline;
    font-weight: normal;
    margin-left: 5px;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

.small {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Druk */
@media print {
    header, .logout-bar, .tabs, .btn-action, .modal-actions, .close {
        display: none !important;
    }
    
    .modal {
        position: static;
        background: white;
        display: block !important;
    }
    
    .modal-content {
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        max-width: 100%;
    }
    
    .id-card-preview img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* Responsywność */
@media (max-width: 768px) {
    .row {
        flex-direction: column;
        gap: 0;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
    }
    
    table {
        font-size: 12px;
    }
    
    td, th {
        padding: 8px 4px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box button {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
}