/* assets/css/main.css – Kompletní moderní vzhled aplikace, levého sidebaru, tabulek, sticky hlavičky a stránkování */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f1f5f9;
    color: #0f172a;
    margin: 0;
    padding-left: 250px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
   LEVÝ BOČNÍ PANEL (#app-sidebar)
   ========================================================= */
#app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    background: #0f172a;
    color: #f8fafc;
    padding: 18px 16px;
    z-index: 1200;
    overflow-y: auto;
    border-right: 1px solid #1e293b;
    box-shadow: 4px 0 16px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
}

#app-sidebar nav a {
    transition: background-color 0.15s ease, color 0.15s ease;
}

#app-sidebar nav a:hover {
    background-color: #1e293b;
    color: #38bdf8 !important;
}

.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1300;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 992px) {
    body {
        padding-left: 0;
    }
    #app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }
    #app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 24px;
}

/* =========================================================
   KARTY SEKCÍ & STICKY AKTIVNÍ ZAKÁZKA
   ========================================================= */
.card-section {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.sticky-active-order {
    position: sticky;
    top: 10px;
    z-index: 950;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border: 2px solid #0284c7;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.14);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =========================================================
   TABULKY PŘEHLEDŮ (.hw-list-table) & STRÁNKOVÁNÍ
   ========================================================= */
.hw-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.hw-list-table thead tr {
    background: #f1f5f9;
}

.hw-list-table th {
    padding: 11px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
    white-space: nowrap;
}

.hw-list-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
    vertical-align: middle;
}

.hw-list-table tbody tr:last-child td {
    border-bottom: none;
}

.hw-list-table tbody tr:hover {
    background-color: #f8fafc;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.page-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.page-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* =========================================================
   TLAČÍTKA A FORMULÁŘOVÉ PRVKY
   ========================================================= */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea,
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus, .form-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-primary,
.btn-success,
.btn-danger,
.btn-warn,
.btn-outline {
    padding: 8px 16px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn-primary { background: #0284c7; }
.btn-primary:hover { background: #0369a1; }

.btn-success { background: #10b981; }
.btn-success:hover { background: #059669; }

.btn-danger  { background: #ef4444; }
.btn-danger:hover  { background: #dc2626; }

.btn-warn    { background: #ea580c; }
.btn-warn:hover    { background: #c2410c; }

.btn-outline {
    background: #ffffff;
    color: #334155;
    border-color: #cbd5e1;
}
.btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-action {
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-outline-edit {
    border: 1px solid #38bdf8;
    color: #0284c7;
    background: #f0f9ff;
}
.btn-outline-edit:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.btn-outline-copy {
    border: 1px solid #5eead4;
    color: #0f766e;
    background: #f0fdfa;
}
.btn-outline-copy:hover {
    background: #0d9488;
    color: #ffffff;
    border-color: #0d9488;
}

.btn-outline-delete {
    border: 1px solid #fca5a5;
    color: #dc2626;
    background: #fef2f2;
}
.btn-outline-delete:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* =========================================================
   ODZNAKY A POMOCNÉ TEXTY
   ========================================================= */
.text-muted {
    font-size: 0.82rem;
    color: #64748b;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.badge-green:hover {
    background: #bbf7d0;
}

.alert-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.86rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.empty-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.88rem;
    padding: 24px 12px;
}

/* =========================================================
   MODÁLNÍ OKNA (#app-modal-overlay)
   ========================================================= */
.modal-overlay,
.submodal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-box {
    background: #ffffff;
    border-radius: 12px;
    max-width: 980px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.3);
}

.submodal-box {
    background: #ffffff;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.35);
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 1.4rem;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.modal-footer-bar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* =========================================================
   SPRÁVA MATERIÁLŮ ZAKÁZKY (3 SLOUPCE)
   ========================================================= */
.mat-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-right: 40px;
}
.mat-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.mat-manager-wrap {
    display: grid;
    grid-template-columns: 320px 240px 1fr;
    gap: 16px;
    height: 70vh;
    min-height: 480px;
}
@media (max-width: 1100px) {
    .mat-manager-wrap {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.mat-col-panel,
.mat-grid-panel {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mat-col-header {
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}

.mat-col-body,
.mat-grid-scroll {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.filter-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    margin: 10px 0 5px;
}
.filter-label:first-child {
    margin-top: 0;
}

.thickness-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.thickness-pill {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}
.thickness-pill:hover {
    background: #f1f5f9;
}
.thickness-pill.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.selected-mat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selected-mat-item {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.selected-mat-item.is-main {
    border-color: #0284c7;
    background: #f0f9ff;
}

.selected-mat-thumb {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
}

.item-actions {
    display: flex;
    gap: 3px;
}
.item-actions button {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    font-size: 0.72rem;
}
.item-actions button:hover:not(:disabled) {
    background: #e2e8f0;
}

.mat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.mat-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.mat-card:hover {
    transform: translateY(-2px);
    border-color: #94a3b8;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}
.mat-card.selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.mat-card-thumb {
    height: 110px;
    background: #e2e8f0;
    position: relative;
}
.mat-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mat-card-badge-tl {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.82);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.mat-card-badge-sel {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #16a34a;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
}
.mat-card-badge-used {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #ea580c;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.mat-card-body {
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
}
/* =========================================================
   NÁHLED OBRÁZKU KOVÁNÍ PŘI NAJETÍ MYŠÍ (.hw-img-hover)
   ========================================================= */
.hw-img-hover {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: middle;
}

.hw-img-icon {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.85;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.hw-img-hover:hover .hw-img-icon {
    opacity: 1;
    transform: scale(1.15);
}

.hw-img-popup {
    display: none;
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3000;
    background: #ffffff;
    border: 2px solid #0284c7;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
    pointer-events: none;
}

.hw-img-popup img {
    display: block;
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
}

.hw-img-hover:hover .hw-img-popup {
    display: block;
}