/**
 * DARK-MODE.CSS - KOMPLETNÍ S BOOTSTRAP OVERRIDE
 * ================================================
 * Přepisuje VŠECHNY Bootstrap komponenty
 * Funguje globálně pro všechny aplikace
 * Agresivní !important kde je potřeba
 */

/* ==========================================================================
   DARK MODE - CSS PROMĚNNÉ
   ========================================================================== */

[data-theme="dark"] {
    /* Pozadí */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    
    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Karty */
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    
    /* Formuláře */
    --input-bg: #1e293b;
    --input-border: #475569;
    --input-text: #f1f5f9;
    
    /* Tabulky */
    --table-bg: #1e293b;
    --table-header-bg: #334155;
    --table-border: #475569;
    --table-hover: rgba(255, 255, 255, 0.05);
    
    /* Bordery */
    --border-color: #334155;
    
    /* Stíny */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   DARK MODE - BODY & ZÁKLADY
   ========================================================================== */

[data-theme="dark"] body {
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] #sklad-app {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP TABULKY (KRITICKÉ!)
   ========================================================================== */

[data-theme="dark"] .table,
[data-theme="dark"] table {
    --bs-table-bg: #1e293b !important;
    --bs-table-striped-bg: #1e293b !important;
    --bs-table-hover-bg: #334155 !important;
    --bs-table-color: #f1f5f9 !important;
    --bs-table-border-color: #475569 !important;
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .table thead,
[data-theme="dark"] table thead {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] table thead th {
    background-color: #334155 !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .table tbody,
[data-theme="dark"] table tbody {
    background-color: #1e293b !important;
}

[data-theme="dark"] .table tbody tr,
[data-theme="dark"] table tbody tr {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .table tbody td,
[data-theme="dark"] table tbody td,
[data-theme="dark"] .table tbody th,
[data-theme="dark"] table tbody th {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .table tbody tr:hover,
[data-theme="dark"] table tbody tr:hover {
    background-color: #334155 !important;
}

[data-theme="dark"] .table tbody tr:hover td,
[data-theme="dark"] table tbody tr:hover td {
    background-color: #334155 !important;
}

/* Table striped */
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) > *,
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: #1e293b !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(even) > *,
[data-theme="dark"] .table-striped tbody tr:nth-of-type(even) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Table hover */
[data-theme="dark"] .table-hover tbody tr:hover > * {
    background-color: #334155 !important;
}

/* Table light/dark varianty */
[data-theme="dark"] .table-light {
    --bs-table-bg: #334155 !important;
    --bs-table-color: #f1f5f9 !important;
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .table-dark {
    --bs-table-bg: #1e293b !important;
    --bs-table-color: #f1f5f9 !important;
}

/* Text v tabulkách */
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] table td,
[data-theme="dark"] table th {
    color: #f1f5f9 !important;
}

/* Linky v tabulkách */
[data-theme="dark"] .table a:not(.btn),
[data-theme="dark"] table a:not(.btn) {
    color: #60a5fa;
}

[data-theme="dark"] .table a:not(.btn):hover,
[data-theme="dark"] table a:not(.btn):hover {
    color: #93c5fd;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP KARTY
   ========================================================================== */

[data-theme="dark"] .card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-header {
    background-color: #334155 !important;
    border-bottom-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-body {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-footer {
    background-color: #334155 !important;
    border-top-color: #475569 !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .card-subtitle {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-text {
    color: #cbd5e1 !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP FORMULÁŘE
   ========================================================================== */

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input.form-control,
[data-theme="dark"] select.form-select,
[data-theme="dark"] textarea.form-control {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #1e293b !important;
    border-color: #667eea !important;
    color: #f1f5f9 !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .form-label {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .form-text {
    color: #64748b !important;
}

[data-theme="dark"] .form-check-input {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .form-check-input:checked {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

[data-theme="dark"] .form-check-label {
    color: #f1f5f9 !important;
}

/* Input groups */
[data-theme="dark"] .input-group-text {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP BUTTONS
   ========================================================================== */

[data-theme="dark"] .btn-light {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-light:hover {
    background-color: #475569 !important;
    border-color: #667eea !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-outline-light {
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .btn-outline-light:hover {
    background-color: #334155 !important;
    border-color: #667eea !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-outline-dark {
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .btn-outline-dark:hover {
    background-color: #334155 !important;
    border-color: #667eea !important;
    color: #f1f5f9 !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP ALERTS
   ========================================================================== */

[data-theme="dark"] .alert {
    border-width: 1px;
    border-style: solid;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.2) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
}

[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-error {
    background-color: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.2) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(59, 130, 246, 0.2) !important;
    border-color: #3b82f6 !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .alert-light {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .alert-secondary {
    background-color: rgba(156, 163, 175, 0.2) !important;
    border-color: #6b7280 !important;
    color: #d1d5db !important;
}

/* Alert text */
[data-theme="dark"] .alert h5,
[data-theme="dark"] .alert h6,
[data-theme="dark"] .alert strong,
[data-theme="dark"] .alert p {
    color: inherit !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP MODALS
   ========================================================================== */

[data-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .modal-header {
    background-color: #334155 !important;
    border-bottom-color: #475569 !important;
}

[data-theme="dark"] .modal-title {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-body {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-footer {
    background-color: #334155 !important;
    border-top-color: #475569 !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP DROPDOWNS
   ========================================================================== */

[data-theme="dark"] .dropdown-menu {
    background-color: rgba(15, 23, 42, 0.98) !important;
    border-color: rgba(102, 126, 234, 0.3) !important;
}

[data-theme="dark"] .dropdown-item {
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(102, 126, 234, 0.3) !important;
    color: white !important;
}

[data-theme="dark"] .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP ACCORDION
   ========================================================================== */

[data-theme="dark"] .accordion-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .accordion-button {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: rgba(102, 126, 234, 0.2) !important;
    color: #667eea !important;
}

[data-theme="dark"] .accordion-body {
    background-color: #334155 !important;
    color: #cbd5e1 !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP BADGES
   ========================================================================== */

[data-theme="dark"] .badge.bg-light {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .badge.bg-secondary {
    background-color: rgba(156, 163, 175, 0.3) !important;
    color: #d1d5db !important;
    border: 1px solid #6b7280;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP LIST GROUP
   ========================================================================== */

[data-theme="dark"] .list-group-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .list-group-item:hover {
    background-color: #334155 !important;
}

[data-theme="dark"] .list-group-item.active {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP PAGINATION
   ========================================================================== */

[data-theme="dark"] .page-link {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .page-link:hover {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .page-item.active .page-link {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #64748b !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP BREADCRUMB
   ========================================================================== */

[data-theme="dark"] .breadcrumb {
    background-color: #334155 !important;
}

[data-theme="dark"] .breadcrumb-item {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: #64748b !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP PROGRESS
   ========================================================================== */

[data-theme="dark"] .progress {
    background-color: #334155 !important;
}

/* ==========================================================================
   DARK MODE - BOOTSTRAP NAV TABS
   ========================================================================== */

[data-theme="dark"] .nav-tabs {
    border-bottom-color: #334155 !important;
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1e293b !important;
    border-color: #334155 #334155 #1e293b !important;
    color: #f1f5f9 !important;
}

/* ==========================================================================
   DARK MODE - SKLAD SPECIFICKÉ
   ========================================================================== */

[data-theme="dark"] .status-koncept {
    background-color: rgba(156, 163, 175, 0.25) !important;
    color: #d1d5db !important;
    border-color: #6b7280 !important;
}

[data-theme="dark"] .status-priprava,
[data-theme="dark"] .status-připraveno {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .status-baleni {
    background-color: rgba(245, 158, 11, 0.25) !important;
    color: #fbbf24 !important;
    border-color: #f59e0b !important;
}

[data-theme="dark"] .status-zabaleno {
    background-color: rgba(34, 197, 94, 0.25) !important;
    color: #4ade80 !important;
    border-color: #22c55e !important;
}

[data-theme="dark"] .status-expedovano {
    background-color: rgba(168, 85, 247, 0.25) !important;
    color: #c084fc !important;
    border-color: #a855f7 !important;
}

[data-theme="dark"] .status-zruseno {
    background-color: rgba(239, 68, 68, 0.25) !important;
    color: #f87171 !important;
    border-color: #ef4444 !important;
}

[data-theme="dark"] .weight-card.saved-weight {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

[data-theme="dark"] .item-row:hover {
    background-color: rgba(102, 126, 234, 0.15) !important;
}

[data-theme="dark"] .drag-over {
    background-color: rgba(102, 126, 234, 0.2) !important;
}

[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item.active {
    background-color: rgba(102, 126, 234, 0.2) !important;
}

/* ==========================================================================
   DARK MODE - TOAST
   ========================================================================== */

[data-theme="dark"] .toast-notification .toast-close:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   DARK MODE - SCROLLBAR
   ========================================================================== */

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b !important;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569 !important;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b !important;
}

/* ==========================================================================
   DARK MODE - TRANSITIONS
   ========================================================================== */

* {
    transition-property: background-color, border-color, color;
    transition-duration: 300ms;
    transition-timing-function: ease;
}

button,
.btn,
input,
select,
textarea,
.form-control,
.form-select {
    transition-duration: 150ms;
}

/* ==========================================================================
   PRINT MODE - VŽDY SVĚTLÝ
   ========================================================================== */

@media print {
    [data-theme="dark"] * {
        background: white !important;
        color: black !important;
        border-color: #dee2e6 !important;
    }
}