/* =========================================
   MAIN STYLES - MODERN DARK THEME
   ========================================= */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-purple: #9333ea;
    --border-color: #475569;
    --table-header-bg: #1e293b;
    --table-row-bg: #334155;
    --table-row-hover: #475569;
}

/* =========================================
   GLOBAL STYLES
   ========================================= */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary) !important;
    overflow-x: hidden;
}

/* =========================================
   MAIN CONTENT AREA
   ========================================= */

.main-content {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 0;
    transition: margin-left 0.3s ease;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}

/* Content header */
.content-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.9));
    padding: 25px 30px;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.content-header h1 {
    color: var(--text-primary) !important;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.content-header h1 i {
    color: var(--accent-blue) !important;
}

/* Content inner */
.content-inner {
    padding: 30px;
    max-width: 100%;
    width: 100%;
}

/* =========================================
   ALERTS / MESSAGES
   ========================================= */

.alert {
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.alert-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
}

.alert-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white !important;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white !important;
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
}

/* =========================================
   FILTERS & SEARCH
   ========================================= */

.content-filters {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.search-form {
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.input-group .form-control {
    flex: 1;
    min-width: 200px;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 10px 15px;
    font-size: 0.95rem;
}

.input-group .form-control:focus {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
    color: var(--text-primary) !important;
}

.input-group .form-control::placeholder {
    color: var(--text-secondary) !important;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================
   BUTTONS
   ========================================= */

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white !important;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white !important;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

/* Small buttons */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
}

/* =========================================
   TABLES - SEPARATE FROM BACKGROUND
   ========================================= */

.table-responsive {
    background: var(--table-row-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(59, 130, 246, 0.2);
    overflow-x: auto;
}

.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    background-color: transparent !important;
}

/* Table header - DISTINCTLY SEPARATE */
.table thead {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table thead th {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    color: var(--text-primary) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 16px 12px !important;
    border-bottom: 3px solid var(--accent-blue) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: 1px solid rgba(59, 130, 246, 0.15) !important;
    white-space: nowrap;
}

.table thead th:last-child {
    border-right: none !important;
}

/* Table header links */
.table thead th a {
    color: var(--text-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: color 0.3s ease;
}

.table thead th a:hover {
    color: var(--accent-blue) !important;
}

/* Table body - DISTINCTLY SEPARATE FROM HEADER */
.table tbody {
    background-color: #475569 !important;
}

.table tbody tr {
    background-color: #475569 !important;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
}

.table tbody tr:nth-child(even) {
    background-color: #3b4a5f !important;
}

.table tbody tr:hover {
    background-color: #5a6d85 !important;
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.table tbody td {
    padding: 14px 12px !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem;
    border: none !important;
    vertical-align: middle;
}

.table tbody td strong {
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* Table warning/danger rows */
.table-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2)) !important;
}

.table-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2)) !important;
}

/* Empty table message */
.table tbody td.text-center {
    padding: 40px 20px !important;
}

.table tbody td .text-muted {
    color: var(--text-secondary) !important;
}

/* =========================================
   BADGES
   ========================================= */

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
}

.badge-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white !important;
}

.badge-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
}

.badge-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white !important;
}

.badge-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white !important;
}

.badge-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white !important;
}

/* =========================================
   CARDS
   ========================================= */

.card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.9)) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(147, 51, 234, 0.25)) !important;
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 15px 20px;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.card-body {
    background: rgba(30, 41, 59, 0.4) !important;
    color: var(--text-primary) !important;
    padding: 20px;
}

/* =========================================
   FORMS
   ========================================= */

.form-label {
    color: var(--text-primary) !important;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 10px 15px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.8;
}

select option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* =========================================
   SESSION WARNING
   ========================================= */

.session-warning-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white !important;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 400px;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.session-warning-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-warning-content i {
    color: white !important;
    font-size: 1.2rem;
}

.session-warning-content strong {
    color: white !important;
}

.session-warning-content button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    margin-left: auto;
}

.session-warning-content button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================================
   UTILITY CLASSES
   ========================================= */

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.me-1 {
    margin-right: 0.25rem;
}

.me-2 {
    margin-right: 0.5rem;
}

.ms-2 {
    margin-left: 0.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

/* Password cell */
.password-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 768px) {
    /* Main content - pełna szerokość */
    .main-content {
        margin-left: 0;
        padding-top: 70px; /* Miejsce na przycisk hamburger */
    }
    
    /* Header */
    .content-header {
        padding: 15px 20px 15px 70px; /* Miejsce na przycisk */
    }
    
    .content-header h1 {
        font-size: 1.2rem;
    }
    
    .content-header .d-flex {
        font-size: 0.85rem;
    }
    
    /* Content inner */
    .content-inner {
        padding: 15px;
    }
    
    /* Filtry i wyszukiwanie */
    .content-filters {
        padding: 15px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .form-control {
        min-width: 100%;
        margin-bottom: 10px;
    }
    
    /* Przyciski akcji */
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Tabele - responsive scroll */
    .table-responsive {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 800px; /* Minimalna szerokość dla scroll */
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px 8px !important;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    /* Przyciski w tabeli - mniejsze */
    .table .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .table .btn-sm {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    
    .table .btn-sm i {
        font-size: 0.85rem !important;
    }
    
    /* Badge */
    .badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Formularze */
    .form-control,
    .form-select {
        font-size: 16px !important; /* Zapobiega zoom na iOS */
    }
    
    /* Alerts */
    .alert {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* Bardzo małe ekrany (smartfony pionowo) */
@media (max-width: 480px) {
    .content-header {
        padding: 10px 15px 10px 60px;
    }
    
    .content-header h1 {
        font-size: 1rem;
    }
    
    .content-inner {
        padding: 10px;
    }
    
    /* Ukryj niektóre kolumny w tabeli na bardzo małych ekranach */
    .table thead th:nth-child(n+6),
    .table tbody td:nth-child(n+6) {
        display: none;
    }
    
    .table {
        min-width: 600px;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
}

/* =========================================
   DROPDOWN MENU FIXES FOR DARK THEME
   ========================================= */

/* Poprawka dla dropdown-menu w ciemnym motywie */
.dropdown-menu {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
}

.dropdown-item {
    color: var(--text-primary) !important;
    padding: 8px 16px !important;
}

.dropdown-item:hover, 
.dropdown-item:focus {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.dropdown-item.text-danger {
    color: #dc3545 !important;
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.dropdown-divider {
    border-top-color: var(--border-color) !important;
    margin: 0.5rem 0 !important;
}

/* Poprawka dla dropdown-menu w różnych kontekstach */
.btn-group .dropdown-menu,
.dropdown .dropdown-menu {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

/* Landscape orientation dla małych ekranów */
@media (max-width: 768px) and (orientation: landscape) {
    .content-header {
        padding: 10px 15px 10px 60px;
    }
    
    .content-header h1 {
        font-size: 1.1rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 8px 6px !important;
        font-size: 0.8rem;
    }
}


