/* Reset i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Ekran logowania */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
}

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

.login-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.login-error.show {
    display: block;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Lewy panel - Sidebar */
.sidebar {
    width: 14.2857%; /* 1/7 */
    min-width: 200px;
    background-color: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.logo {
    padding: 20px;
    background-color: #34495e;
    text-align: center;
    border-bottom: 1px solid #4a6741;
}

.logo h2 {
    font-size: 1.2em;
    margin: 0;
}

.user-info {
    padding: 20px;
    border-top: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-info span {
    font-size: 14px;
    color: #ecf0f1;
    text-align: center;
}

.user-info button {
    width: 100%;
}

.menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu li {
    border-bottom: 1px solid #34495e;
}

.menu-item {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.menu-item:hover {
    background-color: #34495e;
}

.menu-item.active {
    background-color: #3498db;
}

/* Prawy panel - Główna treść */
.main-content {
    width: 85.7143%; /* 6/7 */
    flex: 1;
    padding: 0;
    background-color: white;
    overflow-y: auto;
}

.view {
    display: none;
    padding: 20px;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.view-header h1 {
    color: #2c3e50;
    font-size: 2em;
    margin: 0;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Formularze i kontrolki */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 10px;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.search-container {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    background-color: #f8f9fa;
}

/* Grid uczestników */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.participant-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.participant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.participant-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.participant-frequency {
    color: #7f8c8d;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.participant-roles {
    margin-bottom: 15px;
}

.role-tag {
    display: inline-block;
    background-color: #ecf0f1;
    color: #2c3e50;
    padding: 3px 8px;
    margin: 2px;
    border-radius: 15px;
    font-size: 0.8em;
}

.participant-actions {
    display: flex;
    gap: 10px;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #ddd;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.role-checkbox {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    font-weight: normal !important;
}

.role-checkbox input {
    margin-right: 8px;
}

.role-checkbox:hover {
    background-color: #e9ecef;
}

/* Plany zebrań */
.meeting-week {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.meeting-date {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-week-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    text-transform: none;
}

.export-week-btn:hover {
    background: #219a52;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.meeting-section {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.meeting-section:last-child {
    border-bottom: none;
}

.section-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid currentColor;
}

.section-treasures {
    color: #09505c;
}

.section-ministry {
    color: #774700;
}

.section-christian-living {
    color: #691a1a;
}

.section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.section-item:last-child {
    border-bottom: none;
}

.item-time {
    font-weight: bold;
    color: #7f8c8d;
    min-width: 60px;
}

.item-title {
    flex: 1;
    margin: 0 15px;
}

.item-participant {
    font-weight: bold;
    color: #2c3e50;
    min-width: 150px;
    text-align: right;
}

/* Tabele dyżurów */
.duty-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.duty-table th {
    background-color: #2c3e50;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: bold;
}

.duty-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
}

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

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

.date-cell {
    font-weight: bold;
    color: #2c3e50;
    background-color: #ecf0f1 !important;
}

/* Ustawienia */
.settings-container {
    max-width: 800px;
}

.setting-group {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.setting-group h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.setting-group p {
    margin-bottom: 10px;
    color: #7f8c8d;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

.setting-separator {
    height: 1px;
    background: #ecf0f1;
    margin: 25px 0;
    border: none;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

.form-input[type="date"] {
    max-width: 200px;
}

#rotation-settings {
    display: grid;
    gap: 15px;
}

/* Style dla edytowalnego planu */
.editable-plan .section-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.item-title-input {
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px;
    font-weight: bold;
    flex: 1;
    margin-right: 10px;
}

.item-time-input {
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px;
    width: 60px;
    text-align: center;
    font-weight: bold;
    margin-right: 5px;
}

.time-label {
    background: #6c757d;
    color: white;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.item-time {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

/* Całkowity czas zebrania */
.meeting-total-time {
    margin-top: 15px;
    padding: 10px;
    background: #e8f5e8;
    border: 1px solid #c3e6c3;
    border-radius: 5px;
    text-align: center;
}

.total-time {
    font-weight: bold;
    font-size: 16px;
    color: #155724;
}

.total-time.over-time {
    color: #721c24;
    background: #f8d7da;
    border-color: #f5c6cb;
}

.assignment-controls {
    margin-top: 10px;
}

.participant-assignment {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.participant-assignment label {
    font-weight: bold;
    margin: 0;
    font-size: 12px;
    color: #495057;
}

.participant-selector {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

/* Kolorowanie uczestników w listach rozwijanych */
.participant-selector.available {
    background-color: #d4edda; /* ZIELONY - wolny (za więcej niż 2 tygodnie) */
    border-color: #c3e6cb;
    color: #155724;
}

.participant-selector.assigned-next-week {
    background-color: #fff3cd; /* ŻÓŁTY - następny tydzień lub ostatnie 2 tygodnie */
    border-color: #ffeaa7;
    color: #856404;
}

.participant-selector.assigned-same-week {
    background-color: #f8d7da; /* CZERWONY - ten sam tydzień */
    border-color: #f5c6cb;
    color: #721c24;
}

/* Opcje w dropdownach - kolory */
.participant-selector option.option-available {
    background-color: #d4edda;
    color: #155724;
}

.participant-selector option.option-assigned-next-week {
    background-color: #fff3cd;
    color: #856404;
}

.participant-selector option.option-assigned-same-week {
    background-color: #f8d7da;
    color: #721c24;
}

.helper-separator {
    font-weight: bold;
    margin: 0 5px;
    color: #6c757d;
}

.assignment-reason {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 3px;
    padding: 5px 8px;
    font-size: 12px;
    color: #856404;
    margin-top: 5px;
    font-style: italic;
}

/* Role management */
.roles-management {
    margin-top: 20px;
}

.role-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    margin-bottom: 5px;
}

.role-item .role-name {
    font-weight: bold;
}

.role-item .role-status {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.role-item .remove-role-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
}

.add-role-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
}

/* Eksport - ukryj kolory */
@media print {
    .participant-selector {
        background-color: white !important;
        border-color: #ddd !important;
    }
    
    .assignment-reason {
        display: none;
    }
    
    .item-title-input {
        border: none;
        background: transparent;
    }
}

/* Responsywność */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: auto;
    }
    
    .menu {
        display: flex;
        overflow-x: auto;
    }
    
    .menu li {
        border-bottom: none;
        border-right: 1px solid #34495e;
        min-width: 200px;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .participants-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px auto;
    }
    
    .roles-grid {
        grid-template-columns: 1fr;
    }
}

/* Eksport HTML - style dla wydruku */
@media print {
    .no-print {
        display: none !important;
    }
    
    .meeting-week {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .duty-table {
        page-break-inside: avoid;
    }
}

/* Tooltip dla uczestników */
.participant-tooltip {
    position: absolute;
    background: #2c3e50;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.participant-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #2c3e50;
}

.tooltip-assignment {
    margin: 5px 0;
    padding: 5px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.tooltip-date {
    font-weight: bold;
    color: #3498db;
}

/* Nowe kolory dla dropdownów po wyborze */
.participant-selector.selected-ok {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.participant-selector.selected-conflict {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Ikony statusu obok selectów */
.status-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 16px;
    vertical-align: middle;
}

/* Textarea dla opisów */
.form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Zarządzanie operatorami */
.operators-management {
    margin-top: 20px;
}

.operator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    margin-bottom: 5px;
}

.operator-item .operator-username {
    font-weight: bold;
}

.operator-item .operator-actions {
    display: flex;
    gap: 5px;
}

.operator-item button {
    padding: 3px 8px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.operator-item .edit-operator-btn {
    background: #3498db;
    color: white;
}

.operator-item .remove-operator-btn {
    background: #dc3545;
    color: white;
}

.role-description {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.role-description-label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #495057;
}

.role-description-text {
    color: #6c757d;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.edit-role-btn {
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

/* Checkboxy zakresu obowiązków roli */
.role-scope-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.role-scope-checkbox {
    display: flex;
    align-items: center;
    padding: 6px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
}

.role-scope-checkbox input {
    margin-right: 6px;
}

.role-scope-checkbox:hover {
    background-color: #e9ecef;
    cursor: pointer;
}

.role-scope-section-title {
    font-weight: bold;
    font-size: 14px;
    margin-top: 15px;
    margin-bottom: 8px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

/* Kolory specjalne dla ról */
.role-chairman { background-color: #3498db !important; color: white; }
.role-treasures { color: #09505c !important; }
.role-ministry { color: #774700 !important; }
.role-christian-living { color: #691a1a !important; }

/* Nieobecności */
.absence-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.absence-item input {
    margin-bottom: 0;
}

.remove-absence {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
}

/* Animacje */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Narzędzia pomocnicze */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: bold; }
.text-muted { color: #7f8c8d; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

/* Przyciski do zarządzania punktami w zebraniach */
.add-item-btn {
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 10px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.add-item-btn:hover {
    background-color: #229954;
}

.remove-item-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.remove-item-btn:hover {
    background-color: #c0392b;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Style dla zarządzania eksportami */
.exports-list {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.export-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-info {
    flex: 1;
}

.export-info strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 3px;
}

.export-info small {
    color: #6c757d;
    font-size: 12px;
}

.export-actions {
    display: flex;
    gap: 8px;
}

.export-actions .btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* Style dla logów systemu */
.logs-view {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.log-entry {
    background: white;
    border-left: 4px solid #007bff;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 0 3px 3px 0;
}

.log-entry.warning {
    border-left-color: #ffc107;
}

.log-entry.error {
    border-left-color: #dc3545;
}

.log-entry.success {
    border-left-color: #28a745;
}

.log-timestamp {
    font-size: 11px;
    color: #6c757d;
    font-weight: bold;
}

.log-action {
    font-weight: bold;
    color: #2c3e50;
    margin: 5px 0;
}

.log-details {
    font-size: 13px;
    color: #495057;
}

.log-user {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .export-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .export-actions {
        justify-content: flex-end;
    }
}
}
