:root {
--bg-color: #f4f7f9;
--card-bg-color: #ffffff;
--text-color: #333;
--header-color: #2c3e50;
--border-color: #e0e0e0;
--shadow-color: rgba(0, 0, 0, 0.1);
--primary-btn-bg: #3498db;
--primary-btn-hover-bg: #2980b9;
--table-header-bg: #ecf0f1;
}

body.dark-mode {
--bg-color: #1a202c;
--card-bg-color: #2d3748;
--text-color: #e2e8f0;
--header-color: #ffffff;
--border-color: #4a5568;
--shadow-color: rgba(0, 0, 0, 0.4);
--primary-btn-bg: #4299e1;
--primary-btn-hover-bg: #2b6cb0;
--table-header-bg: #4a5568;
}

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
margin: 0;
padding: 20px;
transition: background-color 0.3s, color 0.3s;
}

.container {
max-width: 1200px;
margin: 0 auto;
}

.card {
background-color: var(--card-bg-color);
border-radius: 8px;
box-shadow: 0 4px 6px var(--shadow-color);
padding: 20px;
margin-bottom: 20px;
transition: background-color 0.3s;
}

.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}

h1, h2 {
color: var(--header-color);
border-bottom: 2px solid var(--border-color);
padding-bottom: 10px;
margin-bottom: 20px;
}

.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}

.header-controls {
display: flex;
align-items: center;
gap: 20px;
}

.rate-display {
display: flex;
align-items: center;
gap: 8px;
background: var(--card-bg-color);
padding: 5px 10px;
border-radius: 6px;
border: 1px solid var(--border-color);
}

#rateValue {
font-weight: bold;
font-size: 16px;
}

#refreshRate {
font-size: 20px;
line-height: 1;
margin: 0;
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
}

label {
display: block;
margin-bottom: 5px;
font-weight: bold;
font-size: 14px;
}

input[type="number"], input[type="text"], input[type="date"] {
width: 100%;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
box-sizing: border-box;
font-size: 16px;
background-color: var(--bg-color);
color: var(--text-color);
}

button {
background-color: var(--primary-btn-bg);
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
transition: background-color 0.3s;
}

button:hover {
background-color: var(--primary-btn-hover-bg);
}

.import-btn {
background-color: transparent;
color: var(--primary-btn-bg);
border: 1px solid var(--primary-btn-bg);
padding: 8px 12px;
margin-top: 0;
font-size: 14px;
}
.import-btn:hover {
background-color: var(--primary-btn-bg);
color: white;
}

.input-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 10px;
}
.input-grid.three-cols {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.add-cost-form {
margin-top: 20px;
}

table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
table-layout: auto;
}

th, td {
border: 1px solid var(--border-color);
padding: 12px;
text-align: left;
word-wrap: break-word;
}

th {
background-color: var(--table-header-bg);
font-weight: bold;
}

.action-buttons {
display: flex;
flex-wrap: wrap;
gap: 5px;
}

.action-buttons button {
margin: 0;
padding: 5px 8px;
font-size: 12px;
}

.edit-btn { background-color: #2980b9; } .edit-btn:hover { background-color: #2c3e50; }
.copy-btn { background-color: #27ae60; } .copy-btn:hover { background-color: #229954; }
.delete-btn { background-color: #e74c3c; } .delete-btn:hover { background-color: #c0392b; }

/* --- Styly pro záložky --- */
.tabs {
display: flex;
border-bottom: 2px solid var(--border-color);
margin-bottom: 20px;
}
.tab-link {
padding: 10px 20px;
cursor: pointer;
border: none;
background: none;
color: var(--text-color);
font-size: 18px;
border-bottom: 3px solid transparent;
text-decoration: none;
}
.tab-link:hover { color: var(--primary-btn-bg); }
.tab-link.active {
font-weight: bold;
border-bottom: 3px solid var(--primary-btn-bg);
color: var(--text-color);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Styly pro statistiky --- */
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 20px;
margin-bottom: 20px;
text-align: right;
border-bottom: 2px solid var(--border-color);
padding-bottom: 20px;
}
.summary-label {
font-size: 14px;
color: #718096;
}
body.dark-mode .summary-label { color: #a0aec0; }
.summary-value {
display: block;
font-size: 1.25em;
font-weight: bold;
}
.summary-value.profit { color: #27ae60; }

/* --- Styly pro Hromadné Akce --- */
.bulk-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 20px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border-color);
}
.bulk-actions button {
margin-top: 0;
font-size: 14px;
padding: 8px 15px;
}
.bulk-actions button.danger {
background-color: #c0392b;
}
.bulk-actions button.danger:hover {
background-color: #e74c3c;
}

/* Úprava pro checkbox sloupec */
.checkbox-col {
width: 40px;
text-align: center;
}
.checkbox-col input {
width: 18px;
height: 18px;
}

/* --- Styly pro přepínač --- */
.theme-switch-wrapper { display: flex; align-items: center; }
.theme-switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider span { position: absolute; font-size: 20px; transition: opacity 0.4s; user-select: none; }
.sun-icon { top: 7px; left: 8px; opacity: 1; }
.moon-icon { top: 7px; right: 7px; opacity: 0; }
body.dark-mode .sun-icon { opacity: 0; }
body.dark-mode .moon-icon { opacity: 1; }
input:checked + .slider { background-color: #2c3e50; }
.slider.round { border-radius: 34px; }

/* --- Styly pro modální okno --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.6); }
.modal-content {
background-color: var(--card-bg-color);
margin: 10% auto;
padding: 20px;
border: 1px solid var(--border-color);
width: 90%;
max-width: 600px;
border-radius: 8px;
position: relative;
animation: fadeIn 0.3s;
}
@keyframes fadeIn { from {opacity: 0; transform: scale(0.9);} to {opacity: 1; transform: scale(1);} }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover, .close-btn:focus { color: var(--text-color); text-decoration: none; }
.modal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
textarea {
width: 100%;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
background-color: var(--bg-color);
color: var(--text-color);
margin-top: 10px;
font-family: monospace;
}
.modal-content p {
margin-top: 0;
font-size: 14px;
color: #718096;
}
body.dark-mode .modal-content p {
color: #a0aec0;
}

/* --- Styly pro Sklad (Inventory) --- */
.text-green { color: #27ae60; font-weight: bold; }
.text-red { color: #e74c3c; font-weight: bold; }
.text-neutral { color: #7f8c8d; }

.inventory-table th { font-size: 13px; }
.inventory-table td { font-size: 14px; }

.inventory-list { list-style: none; padding: 0; }
.inventory-list li {
border-bottom: 1px solid var(--border-color);
padding: 8px 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.inventory-list li:last-child { border-bottom: none; }

/* --- NOVÉ: Styly pro sbalovací historii a úpravy skladu --- */
.toggle-history-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
    margin-top: 10px;
}
.toggle-history-btn:hover {
    background-color: var(--bg-color);
}
.history-container {
    display: none; /* Defaultně skryté */
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.history-container.open {
    display: block;
}
.arrow-icon {
    transition: transform 0.3s;
}
.history-container.open + .toggle-history-btn .arrow-icon { /* Pokud bychom to otáčeli CSSem */
    transform: rotate(180deg);
}

/* Zvýraznění netto těžby */
.net-mined {
    font-weight: bold;
    color: #2980b9;
}

.currency-toggle {
    background: none;
    border: 1px solid var(--primary-btn-bg);
    color: var(--primary-btn-bg);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8em;
    cursor: pointer;
    margin-left: 5px;
    transition: all 0.2s;
}
.currency-toggle:hover {
    background-color: var(--primary-btn-bg);
    color: white;
}

/* Styly pro audit sekci */
#auditResultContainer {
    animation: fadeIn 0.3s ease-in-out;
}
#auditDebtCzk.text-red { color: #e74c3c; }
#auditDebtCzk.text-green { color: #27ae60; }

/* Kontejner pro vstupy v auditu */
.audit-input-container {
    background-color: #f8f9fa; /* Světlé pozadí defaultně */
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 20px;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Dark mode úpravy pro audit */
body.dark-mode .audit-input-container {
    background-color: #2d3748; /* Tmavé pozadí */
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode select {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

/* Zvětšení detailu toku */
.cashflow-detail {
    font-size: 1.1em;
    margin-bottom: 20px;
    text-align: right;
    background: transparent; 
    /* Pokud chcete podbarvení i zde, přidejte background a dark mode pravidla, 
       ale pro čistotu nechávám transparent, jen zvětšuji písmo. */
}