/* Reset i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.5;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #dee2e6;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.header-text {
    text-align: center;
    flex: 1;
}

.header-spacer {
    width: 200px;
    height: 60px;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.subtitle {
    color: #6c757d;
    font-size: 16px;
    font-weight: 400;
}

/* Training Sections */
.training-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

.training-section {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
    gap: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.court-selection {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 12px 18px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.court-selection label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0;
    white-space: nowrap;
}

.court-buttons {
    display: flex;
    gap: 8px;
}

.court-btn {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.court-btn-duzy {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.court-btn-duzy:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.court-btn-duzy.active {
    background: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.court-btn-maly {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.court-btn-maly:hover {
    background: #1e7e34;
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.court-btn-maly.active {
    background: #1e7e34;
    border-color: #1e7e34;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.court-btn:not(.active) {
    background: #ffffff;
    color: #6c757d;
    border-color: #dee2e6;
}

.court-btn:not(.active):hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
}

/* Schedule Container */
.schedule-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
    min-width: 100%;
    justify-content: flex-start;
}

.schedule-container::-webkit-scrollbar {
    height: 8px;
}

.schedule-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb:hover {
    background: #45a049;
}

/* Day Card */
.day-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    position: relative;
    transition: all 0.2s ease;
    min-height: 140px;
    min-width: 200px;
    flex-shrink: 0;
}

.day-card:hover {
    border-color: #ced4da;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.day-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    text-align: center;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

/* Training Slot */
.training-slot {
    margin-bottom: 8px;
}

/* Input with clear button */
.input-with-clear {
    position: relative;
    display: flex;
    align-items: center;
}

.clear-time-btn {
    position: absolute;
    right: 3px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-time-btn:hover {
    background: #c82333;
    opacity: 1;
    transform: scale(1.1);
}

/* Adjust input padding to make room for clear button */
.input-with-clear input[type="time"] {
    padding-right: 20px;
}

.time-inputs {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11px;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.input-group input:placeholder-shown,
.input-group select:invalid {
    border-color: #e9ecef;
    background: #f8f9fa;
}

.input-group input:not(:placeholder-shown),
.input-group select:valid {
    border-color: #28a745;
    background: #ffffff;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Add Button */
.add-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: 1px solid #ced4da;
    background: #ffffff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}


/* Actions */
.actions {
    text-align: center;
    margin-bottom: 30px;
}

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.calculate-btn, .clear-btn {
    padding: 12px 32px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.calculate-btn {
    background: #007bff;
    color: #ffffff;
}

.calculate-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.clear-btn {
    background: #dc3545;
    color: #ffffff;
}

.clear-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Results Section */
.results-section {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 24px;
}

.results-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 16px;
    text-align: center;
}

.results-table {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.copy-btn {
    background: #6c757d;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.copy-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (min-width: 1200px) {
    .day-card {
        min-width: 220px;
    }
}

@media (max-width: 1024px) {
    .schedule-container {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        justify-content: center;
    }
    
    .header-spacer {
        display: none;
    }
    
    .logo {
        height: 50px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .training-sections {
        gap: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .court-selection {
        align-self: stretch;
        justify-content: flex-start;
        padding: 10px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .court-selection label {
        font-size: 13px;
    }
    
    .court-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    
    .court-btn {
        min-width: 90px;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .schedule-container {
        justify-content: flex-start;
        padding-left: 0;
        padding-right: 0;
    }
    
    .day-card {
        min-width: 160px;
        min-height: 120px;
        flex-shrink: 0;
        order: unset;
    }
    
    .day-card h3 {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .schedule-container {
        justify-content: flex-start;
        gap: 10px;
        padding-left: 0;
        padding-right: 0;
    }
    
    .day-card {
        min-width: 140px;
        min-height: 100px;
        padding: 8px;
        flex-shrink: 0;
        order: unset;
    }
    
    .day-card h3 {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .time-inputs {
        flex-direction: column;
        gap: 4px;
    }
    
    .input-group label {
        font-size: 10px;
    }
    
    .input-group input,
    .input-group select {
        font-size: 11px;
        padding: 4px 6px;
    }
    
    .add-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .clear-time-btn {
        width: 12px;
        height: 12px;
        font-size: 8px;
        right: 2px;
    }
    
    .action-buttons {
        flex-direction: row;
        gap: 10px;
    }
    
    .calculate-btn, .clear-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.footer p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

.footer strong {
    color: #495057;
    font-weight: 600;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Focus States */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Custom Time Picker Styles */
.custom-time-picker {
    position: fixed !important;
    z-index: 9999 !important;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    border: 3px solid #007bff !important;
}

@media (max-width: 768px) {
    .custom-time-picker {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: calc(100vw - 20px) !important;
        max-height: 60vh !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 10000 !important;
    }
}

/* Loading State */
.calculating {
    opacity: 0.6;
    pointer-events: none;
}

/* Success Animation */
@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success {
    animation: success 0.3s ease;
}

/* Empty day styling */
.day-card:has(.training-slot:only-child .start-time:not([value=""])) {
    background: #ffffff;
    border-color: #007bff;
}

/* Training type specific styling */
.training-section:first-child .day-card {
    border-left: 3px solid #28a745;
}

.training-section:nth-child(2) .day-card {
    border-left: 3px solid #ffc107;
}

.training-section:last-child .day-card {
    border-left: 3px solid #6f42c1;
}