* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav h1 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
    font-weight: 500;
}

.nav-links a:hover {
    background: #34495e;
}

.nav-links a.active {
    background: #3498db;
}

/* Dashboard */
.dashboard h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 300;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border-left: 4px solid #3498db;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0.5rem 0;
}

.quick-links {
    text-align: center;
    margin: 3rem 0;
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    margin: 0 0.5rem;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9, #3498db);
}

.btn-small {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

/* Tables */
.table-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    background: white;
}

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

th {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

th:hover {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

tr {
    transition: background 0.2s;
}

tr:hover {
    background: #f8f9fa;
}

tr:nth-child(even) {
    background: #fafafa;
}

tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* Sortowanie tabel */
th.asc .sort-icon,
th.desc .sort-icon {
    color: #3498db;
}

.sort-icon {
    margin-left: 8px;
    font-size: 0.8em;
    transition: color 0.3s;
}

/* Search box */
.search-box {
    margin-bottom: 1.5rem;
    padding: 1rem;
    width: 100%;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
}

.search-box:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Forms */
.filter-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-form label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.filter-form input,
.filter-form select {
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.filter-form input:focus,
.filter-form select:focus {
    outline: none;
    border-color: #3498db;
}

/* Sections */
.firmy-lista, .dzienne-lista, .kierowcy-lista,
.firma-szczegoly, .dzien-szczegoly, .kierowca-szczegoly,
.recent-transports {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.firma-info, .kierowca-info {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #3498db;
}

.firma-info p, .kierowca-info p {
    margin-bottom: 0.5rem;
}

.firma-info strong, .kierowca-info strong {
    color: #2c3e50;
}

/* Status icons and badges */
.status-icon {
    font-size: 1.1rem;
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    margin: 0.1rem;
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.page-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid #e1e1e1;
    background: white;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 500;
}

.page-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.page-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.disabled:hover {
    border-color: #e1e1e1;
    color: inherit;
}

/* Alert messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Back button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #95a5a6;
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 500;
}

.back-button:hover {
    background: #7f8c8d;
    transform: translateX(-3px);
}

/* Summary boxes */
.summary-box {
    background: linear-gradient(135deg, #e8f4fd, #d1ecf1);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #3498db;
}

.summary-box strong {
    color: #2c3e50;
}

/* Badges for counts */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #3498db;
    color: white;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    .nav {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-links {
        justify-content: center;
        margin-top: 1rem;
        width: 100%;
    }
    
    .nav-links > div {
        margin-top: 1rem;
        justify-content: center;
        width: 100%;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
    }
    
    .filter-form input,
    .filter-form select {
        width: 100%;
    }
    
    .btn {
        display: block;
        margin: 0.5rem 0;
        text-align: center;
    }
    
    .quick-links {
        margin: 2rem 0;
    }
    
    .table-container {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .nav h1 {
        font-size: 1.2rem;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-links a {
        display: block;
        text-align: center;
    }
    
    th, td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .search-box {
        padding: 0.75rem;
    }
}

/* Print styles */
@media print {
    .header, .btn, .search-box, .pagination {
        display: none;
    }
    
    .container {
        padding: 0;
    }
    
    table {
        box-shadow: none;
    }
    
    .table-container {
        max-height: none;
        overflow: visible;
        border: none;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden {
    display: none;
}

/* Color utilities */
.text-primary { color: #3498db; }
.text-success { color: #27ae60; }
.text-warning { color: #f39c12; }
.text-danger { color: #e74c3c; }
.text-muted { color: #7f8c8d; }

.bg-primary { background-color: #3498db; }
.bg-success { background-color: #27ae60; }
.bg-warning { background-color: #f39c12; }
.bg-danger { background-color: #e74c3c; }

/* Custom scrollbar for webkit browsers */
.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}