:root {
    --primary: #3d5a45;
    --primary-light: #ecefe3;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #64748b;
    --danger: #ef4444;
    --danger-light: #fee2e2;
}

body {
    font-family: 'Ubuntu', sans-serif;
    background-color: var(--bg);
    margin: 0;
    padding: 15px;
    padding-top: 62px;
    color: var(--text);
    font-size: 13px;
}

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

h1 { font-size: 20px; color: var(--primary); font-weight: 500; margin: 0; text-transform: uppercase; letter-spacing: 1px; text-align: center;}
h2 { font-size: 14px; color: var(--text); font-weight: 500; margin-bottom: 12px; text-align: center; }

.top-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 500;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    background: var(--card-bg); padding: 10px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-bottom: 1px solid var(--border);
}
.top-bar-left { display: flex; align-items: center; gap: 4px; justify-self: start; }
.top-bar-right { display: flex; align-items: center; justify-self: end; }
.top-bar h1 { justify-self: center; }

.status-badge {
    padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
    color: white; background: #94a3b8;
}

.input-control {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; text-align: center; color: var(--text); background: var(--bg);
    box-sizing: border-box; font-family: 'Ubuntu Mono', monospace;
}

.btn {
    padding: 10px 16px; border-radius: 6px; color: white; border: none;
    font-weight: 500; font-size: 13px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: opacity 0.2s, transform 0.1s;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: translateY(1px); }
.btn, .btn-success { background-color: #22c55e; }
.btn-subtle { background-color: #3b82f6; }
.btn-danger { background-color: #ef4444; }
.top-bar-center { display: flex; align-items: center; justify-content: center; gap: 10px; }

.icon-btn {
    background: none; border: none; padding: 4px; cursor: pointer;
    box-shadow: none; display: inline-flex; align-items: center; justify-content: center;
    line-height: 0; transition: opacity 0.2s;
}
.icon-btn:hover { opacity: 0.65; }
.icon-btn:disabled { opacity: 0.25; cursor: default; }
.icon-img { width: 40px; height: 40px; display: block; }
.icon-img-sm { width: 16px; height: 16px; }

.hedgehog-selector {
    display: flex; gap: 15px; margin-bottom: 20px; overflow-x: auto;
    padding: 5px; justify-content: center; width: 100%; flex-wrap: wrap;
}
.hedgehog-item {
    background: var(--card-bg); padding: 10px 8px; border-radius: 10px;
    border: 2px solid var(--border); display: flex; flex-direction: column;
    align-items: center; gap: 8px; width: 88px; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03); cursor: pointer; user-select: none;
    transition: border-color 0.2s, opacity 0.2s;
}
.hedgehog-item.selected { border-color: var(--primary); }
.hedgehog-item.deselected { opacity: 0.55; }
.hedgehog-item.deselected .hedgehog-photo-container { filter: grayscale(1); }
.hedgehog-item-name { font-weight: 600; font-size: 12px; text-align: center; line-height: 1.2; word-break: break-word; }

.hedgehog-photo-container {
    position: relative; width: 56px; height: 56px; border-radius: 50%;
    background: #e2e8f0; overflow: hidden; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; border: 2px solid var(--border);
}
.hedgehog-photo { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { font-size: 9px; color: var(--text-muted); text-transform: uppercase; font-weight: bold; }

.card {
    background: var(--card-bg); padding: 15px; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 20px;
}

.hedgehog-table-block {
    background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border);
    padding: 15px; margin-bottom: 25px; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.hedgehog-table-header {
    display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px;
    padding-bottom: 10px; border-bottom: 2px solid var(--primary-light); flex-wrap: wrap;
    cursor: pointer; user-select: none;
}
.hedgehog-table-header .header-info { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; }
.hedgehog-table-header .header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hedgehog-table-body.collapsed { display: none; }
.hedgehog-table-title { font-size: 18px; font-weight: 700; color: var(--primary); text-align: center; }

.table-container { 
    overflow-x: auto; max-width: 100%; background: var(--card-bg);
    border-radius: 6px; border: 1px solid var(--border); margin-bottom: 10px;
}
table { width: 100%; border-collapse: collapse; min-width: 900px; font-family: 'Ubuntu Mono', monospace; font-size: 12px; }
th, td { border: 1px solid var(--border); padding: 8px; font-size: 12px; text-align: center; }
th { background-color: #f8fafc; color: var(--text-muted); font-weight: 600; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background-color: #f1f5f9; color: var(--text); }

td[contenteditable="true"] { background-color: #fffbeb; cursor: pointer; text-align: center; }
td[contenteditable="true"]:focus { background-color: #fef3c7; outline: 1px solid #f59e0b; }

#toast-container { position: fixed; top: 58px; right: 20px; z-index: 9999; }
.toast {
    padding: 12px 20px; margin-bottom: 8px; border-radius: 6px; color: white;
    font-size: 13px; font-weight: 500; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: fadeIn 0.3s;
}
.toast.success { background-color: #22c55e; }
.toast.error { background-color: #ef4444; }
.toast.info { background-color: #3b82f6; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.cell-photo-thumb {
    width: 35px; height: 35px; object-fit: cover; border-radius: 4px; 
    margin: 1px; border: 1px solid var(--border); display: inline-block; cursor: pointer;
    transition: transform 0.1s;
}
.cell-photo-thumb:hover { transform: scale(1.1); }

.stats-box { padding: 6px 12px; border-radius: 6px; background: #f1f5f9; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.stats-box .icon-img { width: 16px; height: 16px; }
.stats-box.warning { background-color: var(--danger-light); color: #991b1b; border: 1px solid var(--danger); }

.modal-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.4);
    display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: white; padding: 20px; border-radius: 12px; max-width: 550px; width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); text-align: left; max-height: 85vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.modal-header h3 { margin: 0; font-size: 15px; color: var(--text); }
.modal-close { cursor: pointer; font-weight: bold; color: var(--text-muted); font-size: 16px; }

.modal-section { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #f1f5f9; }
.modal-section label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }

.m-jezek-row { display: flex; align-items: center; justify-content: center; padding: 8px 0; border-bottom: 1px dashed #f1f5f9; }
.m-jezek-name { font-weight: 600; padding: 4px 8px; border-radius: 4px; background: #fffbeb; cursor: pointer; border: 1px dashed #f59e0b; }

.slots-config-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; margin-top: 5px; }

.diary-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.diary-photo-wrapper { position: relative; width: 95px; height: 95px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.diary-photo-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.diary-photo-filename { font-size: 8px; background: rgba(0,0,0,0.6); color: white; position: absolute; bottom: 0; left:0; right:0; padding: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diary-photo-delete {
    position: absolute; top: 2px; right: 2px; padding: 2px;
    background: none; border: none; cursor: pointer; box-shadow: none;
    display: flex; align-items: center; justify-content: center;
}
.diary-photo-delete .icon-img { width: 18px; height: 18px; }

.lightbox-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.85);
    display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 2000;
}
.lightbox-img { max-width: 90%; max-height: 80vh; object-fit: contain; border-radius: 4px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.lightbox-caption { color: white; margin-top: 12px; font-size: 14px; text-align: center; background: rgba(0,0,0,0.5); padding: 5px 15px; border-radius: 15px; }
.lightbox-btn { position: absolute; background: rgba(255,255,255,0.15); color: white; border: none; font-size: 24px; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; user-select: none; transition: background 0.2s; }
.lightbox-btn:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-close { top: 20px; right: 20px; font-size: 30px; font-weight: bold; }

/* Cropper modal */
.cropper-modal-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center; z-index: 3000;
}
.cropper-modal-content {
    background: white; padding: 20px; border-radius: 12px; max-width: 700px; width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.cropper-modal-content .cropper-container {
    max-height: 60vh;
}
.cropper-actions {
    display: flex; gap: 10px; justify-content: center; margin-top: 15px;
}
.cropper-actions .btn { min-width: 100px; justify-content: center; }

.card-title { display: flex; align-items: center; justify-content: center; gap: 8px; }
.data-io-row { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }

