/* ============================================================
   ESmont Dashboard — Components
   Card, button, modal, badge, items list, forms, skeleton.
   ============================================================ */

/* ---- Buttons ---- */

button {
    font-size: 15px;
    padding: 10px 20px;
    border: 0;
    border-radius: var(--radius);
    background: var(--border);
    color: var(--brand);
    cursor: pointer;
    font-weight: 500;
    font-family: "Source Sans 3", sans-serif;
    box-shadow: 0 2px 2px 0 hsla(0,0%,90%,.1), 0 3px 1px -2px hsla(0,0%,90%,.18), 0 1px 5px 0 hsla(0,0%,90%,.15);
    transition: all .15s ease-in;
}

button:hover {
    background-color: var(--border);
    box-shadow: 0 8px 14px -8px hsla(0,0%,90%,.3), 0 3px 18px 0 hsla(0,0%,90%,.1), 0 7px 8px -4px hsla(0,0%,90%,.18);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Semantic variants */
button.primary, button.btn-primary {
    background: var(--primary);
    background-image: linear-gradient(195deg, #66bb6a, #43a047);
    color: var(--primary-foreground);
    box-shadow: 0 2px 2px 0 rgba(76,175,80,.1), 0 3px 1px -2px rgba(76,175,80,.18), 0 1px 5px 0 rgba(76,175,80,.15);
}
button.primary:hover, button.btn-primary:hover {
    box-shadow: 0 8px 14px -8px rgba(76,175,80,.3), 0 3px 18px 0 rgba(76,175,80,.1), 0 7px 8px -4px rgba(76,175,80,.18);
}

button.warn, button.btn-warn {
    background: var(--status-queued);
    background-image: linear-gradient(195deg, #ffa726, #fb8c00);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(251,140,0,.1), 0 3px 1px -2px rgba(251,140,0,.18), 0 1px 5px 0 rgba(251,140,0,.15);
}
button.warn:hover, button.btn-warn:hover {
    box-shadow: 0 8px 14px -8px rgba(251,140,0,.3), 0 3px 18px 0 rgba(251,140,0,.1), 0 7px 8px -4px rgba(251,140,0,.18);
}

button.danger, button.btn-danger {
    background: var(--destructive);
    background-image: linear-gradient(195deg, #ef5350, #e53935);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(244,67,53,.1), 0 3px 1px -2px rgba(244,67,53,.18), 0 1px 5px 0 rgba(244,67,53,.15);
}
button.danger:hover, button.btn-danger:hover {
    box-shadow: 0 8px 14px -8px rgba(244,67,53,.3), 0 3px 18px 0 rgba(244,67,53,.1), 0 7px 8px -4px rgba(244,67,53,.18);
}

button.info, button.btn-info {
    background: var(--status-in-progress);
    background-image: linear-gradient(195deg, #49a3f1, #1a73e8);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(33,150,243,.1), 0 3px 1px -2px rgba(33,150,243,.18), 0 1px 5px 0 rgba(33,150,243,.15);
}
button.info:hover, button.btn-info:hover {
    box-shadow: 0 8px 14px -8px rgba(26,115,232,.3), 0 3px 18px 0 rgba(26,115,232,.1), 0 7px 8px -4px rgba(26,115,232,.18);
}
button.info small { font-size: 12px; }

button.btn-outline-secondary {
    box-shadow: none;
    user-select: none;
    border: 1px solid var(--border);
    background-color: transparent;
    color: var(--muted-foreground);
}
button.btn-outline-secondary:hover {
    background-color: transparent;
    opacity: .75;
    box-shadow: none;
}

/* Icon button */
.icon-btn {
    background: var(--border);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    box-shadow: 0 2px 2px 0 hsla(0,0%,90%,.1), 0 3px 1px -2px hsla(0,0%,90%,.18), 0 1px 5px 0 hsla(0,0%,90%,.15);
    transition: all .15s ease-in;
    width: 30px;
     height: 30px;
     text-align: center;
     line-height: 30px;
     border-radius: 30px;
     font-size: 18px;
     font-weight: 300;
     cursor: pointer;
     padding: 0;
}
.icon-btn:hover {
    box-shadow: 0 8px 14px -8px hsla(0,0%,90%,.3), 0 3px 18px 0 hsla(0,0%,90%,.1), 0 7px 8px -4px hsla(0,0%,90%,.18);
    transform: translateY(-1px);
}
.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Old .icon-button class (sub-module compat) */
button.icon-button {
    padding: 8px;
    border-radius: 50%;
    background-color: transparent;
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}
button.icon-button:hover {
    background-color: rgba(0,0,0,.04);
}

/* Small action buttons */
.btn-edit {
    background: var(--primary);
    background-image: linear-gradient(195deg, #66bb6a, #43a047);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(76,175,80,.1), 0 3px 1px -2px rgba(76,175,80,.18), 0 1px 5px 0 rgba(76,175,80,.15);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
}
.btn-delete {
    background-image: linear-gradient(195deg, #ec407a, #d81b60);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(233,30,99,.1), 0 3px 1px -2px rgba(233,30,99,.18), 0 1px 5px 0 rgba(233,30,99,.15);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
}

/* Modal-specific close buttons */
#closeNew, #closeEdit, #closeCust, .modal-close {
    background: var(--destructive);
    background-image: linear-gradient(195deg, #ef5350, #e53935);
    color: #fff;
    box-shadow: 0 2px 2px 0 rgba(244,67,53,.1), 0 3px 1px -2px rgba(244,67,53,.18), 0 1px 5px 0 rgba(244,67,53,.15);
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    padding: 0;
}
#closeNew:hover, #closeEdit:hover, #closeCust:hover, .modal-close:hover {
    box-shadow: 0 8px 14px -8px rgba(244,67,53,.3), 0 3px 18px 0 rgba(244,67,53,.1), 0 7px 8px -4px rgba(244,67,53,.18);
}
.modal-close {
    font-size: 32px;
    font-weight: 300;
    transition: color 0.2s;
}
.modal-close:hover { color: #333; }

/* ---- Card (job board) ---- */

.card {
    background: var(--card);
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border);
    border-top: 4px solid transparent;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: all .3s ease;
}
.card:hover {
    transform: translateY(-2px);
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.card h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--brand); }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--brand); }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: var(--card-padding);
    border-bottom: 1px solid var(--border);
}
.card-body {
    padding: var(--card-padding);
    margin-bottom: auto;
}
.card-footer {
    padding: var(--card-padding);
    border-top: 1px solid var(--border);
}
.card-footer .btns { margin: 0; align-items: center; }

/* Card with recently-uploaded label */
.card--new-label {
    border-left: 4px solid var(--status-in-progress);
}

/* Label button state */
.label-btn--has          { color: #16a34a; }
.label-btn--has svg      { stroke: #16a34a; }

/* Status top-border per board tab */
body[data-status="queued"]      .card { border-top-color: var(--status-queued); }
body[data-status="in_progress"] .card { border-top-color: var(--status-in-progress); }
body[data-status="done"]        .card { border-top-color: var(--status-done); }

/* card button that spans full row on label column */
.card button.label-btn.icon-btn { margin-left: auto; }

/* ---- Dashboard card (module tiles on index page) ---- */

.dashboard-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all .3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}
.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}
.dashboard-card .card-content { padding: 24px; flex: 1; }
.dashboard-card .card-description { font-size: 14px; color: var(--muted-foreground); line-height: 1.5; }
.dashboard-card .card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Card icon strip (coloured banner at top of module tiles) */
.card-header {
    position: relative;
    margin: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(0,0,0,.4);
}
.card-icon {
    width: 64px; height: 64px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: white;
    margin: -32px auto 0;
    position: relative; z-index: 1;
}
.dashboard-card .card-icon {
    margin: 0; width: 100%; border-radius: 0; height: 150px;
}
.dashboard-card .card-icon svg { width: 128px; height: 128px; stroke-width: .5; }

/* Module-specific icon gradients */
.card-icon.icon-vrtani    { background: linear-gradient(195deg, #49a3f1, #1a73e8);   box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(33,150,243,.4); }
.card-icon.icon-roztec    { background: linear-gradient(195deg, #66BB6A, #43A047);   box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(76,175,80,.4); }
.card-icon.icon-vstrikovaci { background: linear-gradient(195deg, #FFA726, #FB8C00); box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(255,152,0,.4); }
.card-icon.icon-cnc       { background: linear-gradient(195deg, #EC407A, #D81B60);   box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4); }
.card-icon.icon-pasy      { background: linear-gradient(195deg, #66bb6a, #43a047);   box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(102,187,106,.4); }
.card-icon.icon-kalendar  { background: linear-gradient(195deg, #ef5350, #e53935);   box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4); }
.card-icon.icon-ski-length { background: linear-gradient(195deg, #49a3f1, #66bb6a);  box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(76,175,80,.4); }

.card-body { text-align: center; }
.card-body h3 { font-size: 18px; font-weight: 600; color: var(--brand); margin-bottom: 8px; }
.card-body p  { color: var(--muted-foreground); font-size: 14px; line-height: 1.5; }

.card-link, .card-link-text {
    color: var(--muted-foreground);
    font-size: 14px;
    text-decoration: none;
    display: flex; align-items: center; gap: 4px;
    transition: color .2s;
}
.card-footer .arrow { color: #99CC33; font-size: 18px; }

/* ---- Skeleton loader ---- */

.skel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-md);
}
.skel-line {
    height: 14px;
    border-radius: 7px;
    margin: 10px 0;
    background: #eee;
    background-image: linear-gradient(90deg, #eee 0px, #f5f5f5 40px, #eee 80px);
    background-size: 600px 100%;
    animation: shimmer 1.2s infinite linear;
}

/* ---- Badge system ---- */

/* Legacy .badge — keeps existing quantity badges intact */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 900;
    padding: 2px 8px;
    background-image: linear-gradient(195deg, #ebeff4, #ced4da);
    box-shadow: 0 2px 2px 0 hsla(0,0%,90%,.1), 0 3px 1px -2px hsla(0,0%,90%,.18), 0 1px 5px 0 hsla(0,0%,90%,.15);
}

/* 8-variant badge — use .badge.badge--* for semantic status chips */
.badge--default     { background: var(--primary);     color: var(--primary-foreground); }
.badge--success     { background: var(--status-done);         color: #fff; }
.badge--warning     { background: var(--status-queued);       color: #000; }
.badge--info        { background: var(--status-in-progress);  color: #fff; }
.badge--destructive { background: var(--destructive);         color: #fff; }
.badge--outline     { background: transparent; border: 1px solid var(--border); color: var(--foreground); }
.badge--secondary   { background: var(--muted);   color: var(--muted-foreground); }
.badge--ghost       { background: transparent;    color: var(--muted-foreground); }

/* Tab new-label indicator badge */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background-color: var(--status-queued);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
    animation: badge-pulse 1.5s ease-in-out infinite;
}
.tab-badge:empty { display: none; }

/* ---- Modal ---- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    /* display controlled by Alpine x-show — no display:none here */
    z-index: 50;
}
.modal {
    position: fixed;
    inset: 0;
    /* display controlled by Alpine x-show — no display:none here */
    z-index: 60;
}
.modal.active {
    /* legacy jQuery toggle — kept for any non-Alpine callers */
    display: block;
    z-index: 999999;
}
.modal-active { overflow: hidden; }

.modal .modal-dialog {
    position: relative;
    margin: 1.75rem;
    pointer-events: none;
    transition: transform .3s ease-out;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(1100px, 96vw);
    max-height: 90vh;
}
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background: var(--card);
    background-clip: padding-box;
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    outline: 0;
    margin: 0 auto;
}
.modal header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle) !important;
    border-radius: 16px 16px 0 0;
    position: relative;
}
.modal .footer {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-subtle);
    background: var(--card);
    border-radius: 0 0 16px 16px;
}
.modal .body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
}
.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(90deg, var(--status-in-progress) 0%, var(--status-done) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    display: inline-block;
}
.modal-body { padding: 15px; }

/* ---- Panel (inside modals) ---- */

.panel {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px;
}
.panel + .panel { overflow: auto; max-height: 40vh; }
.panel h3 {
    margin: 0 0 8px;
    font-size: 16px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1rem;
}

/* ---- Item lines (product catalogue rows) ---- */

.btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
}
#custList .row {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border-subtle);
}
.itemline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px;
    border-bottom: 1px dashed var(--border-subtle);
    font-size: .9rem;
}
.itemline button { padding: 6px; line-height: 10px; height: 22px; width: 22px; text-align: center; }
.qtybox { display: flex; align-items: center; gap: 6px; }
.qtybox button { padding: 0; font-size: 18px; border-radius: 10px; }
.searchbox { display: flex; gap: 8px; margin-bottom: 8px; }

.items { font-size: 14px; line-height: 1.3; }
.items > span { display: block; }
.items > span::before { content: "\00B7"; margin-right: 5px; }
.items > br { display: none !important; }
.items .info { color: var(--status-in-progress); font-weight: 900; }

.note {
    margin-top: 6px;
    font-size: 13px;
    background: var(--muted);
    border: 1px solid var(--muted);
    border-radius: 10px;
    padding: 8px;
}
.model.muted { display: none; }
.kiosk { position: fixed; right: 12px; top: 12px; opacity: .5; }

/* ---- Tables ---- */

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
thead { background: var(--muted); }
tr:hover { background: var(--muted); }
tr:hover td { font-weight: 700; }
tr:hover td.text-primary { color: var(--status-in-progress); font-weight: 700; }

/* Sub-module table variants */
.overview-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.overview-table thead { background: var(--muted); }
.overview-table th {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--foreground);
    font-size: 14px;
    border-bottom: 2px solid var(--border);
}
.overview-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--muted);
    color: var(--muted-foreground);
    font-size: 14px;
}
.overview-table tbody tr:last-child td { border-bottom: none; }
.overview-table tbody tr:hover { background: var(--muted); }
.overview-table .total-row { background: #f0f7ff; border-top: 2px solid #0066cc; }
.overview-table .total-row:hover { background: #e6f2ff; }
.overview-section { margin-bottom: 30px; }
.overview-section:last-child { margin-bottom: 0; }
.overview-section h3 {
    font-size: 18px; font-weight: 600; color: var(--foreground);
    margin: 0 0 15px; display: flex; align-items: center; gap: 8px;
}
.no-data {
    color: var(--muted-foreground);
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: var(--muted);
    border-radius: var(--radius-sm);
}

/* ---- Calendar events (on main dashboard) ---- */

.calendar-card { cursor: default; }
.calendar-card:hover { transform: none; }
.event-item {
    float: left; width: 45%; margin-right: 5%;
    padding: 12px; margin-bottom: 10px;
    background: var(--muted);
    border-left: 3px solid var(--destructive);
    border-radius: 4px; font-size: 13px;
}
.event-item:last-child { margin-bottom: 0; }
.event-date { font-weight: 600; color: var(--destructive); margin-bottom: 4px; }
.event-title { color: var(--foreground); font-weight: 500; }
.no-events { text-align: center; color: var(--muted-foreground); font-size: 14px; padding: 20px; }

/* ---- Ski length selector (rozmery_vrtani) ---- */

#skiLengthSelector { cursor: pointer; transition: all .2s; }
#skiLengthSelector:hover  { border-color: #0066cc; }
#skiLengthSelector:focus  { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,.1); }

/* ---- Misc form helpers ---- */

.info-message {
    padding: 15px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #1976d2;
}

/* ---- Board toolbar (tabs + actions, replaces the old board header) ---- */

#board-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px 10px;
}
#board-toolbar .board-tabs,
#board-toolbar .board-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
#board-toolbar .board-actions input {
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    width: 220px;
}

@media (max-width: 768px) {
    /* the drawer is now the global sidenav, so the toolbar stays:
       tabs beside the hamburger, actions wrapped onto the next line */
    #board-toolbar { padding: 10px 12px 0 60px; }
    #board-toolbar .board-actions { width: 100%; }
    #board-toolbar .board-actions input { flex: 1; min-width: 0; width: auto; }
}

/* ---- Card status (merged Aktivní view) ---- */

.card--queued      { border-top-color: var(--status-queued); }
.card--in_progress { border-top-color: var(--status-in-progress); }
.card--done        { border-top-color: var(--status-done); }

.status-chip {
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
}
.status-chip--queued      { background: #fef3c7; color: #92400e; }
.status-chip--in_progress { background: #e3f2fd; color: #1565c0; }
.status-chip--done        { background: #dcfce7; color: #166534; }
