/* Reset a základní styly */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0A1628 0%, #1a2f42 100%);
    color: white;
    flex-shrink: 0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Výběr firmy */
.firma-selector {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.firma-selector label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.firma-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

.firma-selector select option {
    background: #0A1628;
    color: white;
}

.firma-info {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 12px;
}

/* Navigace */
.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-section {
    margin-bottom: 15px;
}

.nav-section-title {
    display: block;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
}

.nav-subsection {
    margin-left: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: rgba(153, 198, 195, 0.2);
    border-left-color: #99C6C3;
    color: white;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.content-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #0A1628;
}

.content-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#lastUpdate {
    font-size: 13px;
    color: #666;
}

.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Komponenty */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0A1628;
}

.card-content {
    padding: 25px;
}

.card-actions {
    padding: 15px 25px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
}

/* Grid systém */
.row {
    display: flex;
    margin: 0 -10px;
    flex-wrap: wrap;
}

.col {
    padding: 0 10px;
}

.col-1 { width: 8.333%; }
.col-2 { width: 16.666%; }
.col-3 { width: 25%; }
.col-4 { width: 33.333%; }
.col-6 { width: 50%; }
.col-8 { width: 66.666%; }
.col-9 { width: 75%; }
.col-12 { width: 100%; }

/* Tlačítka */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.4;
}

.btn-primary {
    background: #99C6C3;
    color: white;
}

.btn-primary:hover {
    background: #7fb5b1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(153, 198, 195, 0.3);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Formuláře */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: #99C6C3;
    box-shadow: 0 0 0 3px rgba(153, 198, 195, 0.1);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Tabulky */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #0A1628;
    border-bottom: 1px solid #e1e5e9;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.table tr:hover {
    background: #f8f9fa;
}

.table .text-right {
    text-align: right;
}

.table .text-center {
    text-align: center;
}

/* Statistické karty */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0A1628;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.stat-card.positive .stat-value {
    color: #99C6C3;
}

.stat-card.negative .stat-value {
    color: #e74c3c;
}

.stat-card.warning .stat-value {
    color: #C9A84C;
}

/* Grafy */
.chart-container {
    position: relative;
    height: 400px;
    margin: 20px 0;
}

/* Loading stavy */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top: 4px solid #99C6C3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modály */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #0A1628;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #666;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Utility třídy */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.success { color: #27ae60; }
.danger { color: #e74c3c; }
.warning { color: #f39c12; }
.muted { color: #666; }

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2;
        max-height: 400px;
    }

    .main-content {
        order: 1;
    }

    .content-body {
        padding: 20px;
    }

    .content-header {
        padding: 15px 20px;
    }

    .row {
        flex-direction: column;
        margin: 0;
    }

    .col {
        width: 100%;
        padding: 0;
        margin-bottom: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .content-header h1 {
        font-size: 20px;
    }

    .card-content {
        padding: 20px;
    }

    .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .card-actions {
        flex-direction: column;
    }
}
/* Mobile modal fix */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header {
        padding: 16px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px; /* prevent iOS zoom */
        padding: 10px 12px;
        box-sizing: border-box;
    }

    .form-group {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }

    /* Sidebar on mobile — bottom nav instead of top */
    .sidebar {
        max-height: 60px;
        overflow: hidden;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 100;
        order: 2;
    }

    .main-content {
        order: 1;
        padding-bottom: 70px;
    }
}
