/* TapicerCRM — style.css */
@keyframes spin { to { transform: rotate(360deg); } }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #1a1a2e; font-size: 14px; }

/* ── SIDEBAR ── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
    background: #1a1a2e; color: #fff; display: flex; flex-direction: column; z-index: 100;
}
.sidebar-logo { padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 16px; font-weight: 700; color: #e35f14; }
.sidebar-logo span { color: #fff; font-weight: 400; font-size: 12px; display: block; margin-top: 2px; }
.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 18px; cursor: pointer;
    color: rgba(255,255,255,0.65); transition: all 0.15s; font-size: 13.5px;
    border-left: 3px solid transparent; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(227,95,20,0.15); color: #e35f14; border-left-color: #e35f14; }
.nav-icon { width: 18px; text-align: center; font-size: 15px; }
.nav-section { padding: 16px 18px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.3); }
.sidebar-user { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: #e35f14; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-info { font-size: 12px; overflow: hidden; }
.user-info strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { color: rgba(255,255,255,0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.notif { background: #ef4444; color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 6px; margin-left: auto; }

/* ── MAIN ── */
.main { margin-left: 220px; min-height: 100vh; }
.topbar {
    background: #fff; padding: 10px 28px; min-height: 56px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid #e8eaf0; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px 28px; }

/* ── BUTTONS ── */
.btn { padding: 7px 14px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: #e35f14; color: #fff; }
.btn-primary:hover { background: #c9500f; }
.btn-outline { background: #fff; color: #444; border: 1px solid #ddd; }
.btn-outline:hover { background: #f5f5f5; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── CARDS ── */
.card { background: #fff; border-radius: 10px; border: 1px solid #e8eaf0; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; }
.card-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; text-align: center; }

/* ── GRIDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-main-aside { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }

/* ── STAT CARD ── */
.stat-card { background: #fff; border-radius: 10px; padding: 18px 20px; border: 1px solid #e8eaf0; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.orange { background: rgba(227,95,20,0.1); }
.stat-icon.blue   { background: rgba(59,130,246,0.1); }
.stat-icon.green  { background: rgba(34,197,94,0.1); }
.stat-icon.red    { background: rgba(239,68,68,0.1); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: #888; margin-top: 3px; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up   { color: #22c55e; }
.stat-change.down { color: #ef4444; }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #999; font-weight: 600; background: #fafafa; border-bottom: 1px solid #f0f0f0; }
td { padding: 12px 20px; border-bottom: 1px solid #f7f7f7; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbff; cursor: pointer; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-new      { background: #eff6ff; color: #3b82f6; }
.badge-quoted          { background: #fff7ed; color: #ea580c; }
.badge-quote-accepted  { background: #f0fdf4; color: #16a34a; }
.badge-quote-rejected  { background: #fef2f2; color: #dc2626; }
.badge-assigned { background: #fdf4ff; color: #9333ea; }
.badge-progress { background: #fff7ed; color: #e35f14; }
.badge-paused   { background: #fefce8; color: #ca8a04; }
.badge-done     { background: #f0fdf4; color: #22c55e; }
.badge-flag     { background: #fef2f2; color: #ef4444; }
.badge-waiting  { background: #f5f3ff; color: #8b5cf6; }

/* ── FILTERS ── */
.filters-bar { background: #fff; border: 1px solid #e8eaf0; border-radius: 10px; padding: 14px 20px; margin-bottom: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-input { padding: 7px 12px; border: 1px solid #e0e0e0; border-radius: 6px; font-size: 13px; outline: none; background: #fafafa; }
.filter-input:focus { border-color: #e35f14; background: #fff; }
.filter-input.wide { min-width: 220px; }
.filter-date-range { display: flex; align-items: center; gap: 6px; }
.filter-date-range .date-label { font-size: 12px; font-weight: 600; color: #888; white-space: nowrap; }
.filter-date-range .filter-input { width: 140px; }
@media (max-width: 600px) {
    .filters-bar { padding: 12px 14px; gap: 8px; }
    .filter-input.wide { min-width: 0; width: 100%; }
    .filter-date-range { width: 100%; }
    .filter-date-range .filter-input { flex: 1; width: auto; min-width: 0; }
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 6px; font-size: 13px; font-family: inherit; outline: none; background: #fff; transition: border-color 0.15s; }
.form-control:focus { border-color: #e35f14; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11px; color: #aaa; margin-top: 4px; }

/* ── INFO ITEMS ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item label { font-size: 11px; color: #aaa; display: block; margin-bottom: 3px; }
.info-item span { font-size: 14px; font-weight: 500; }

/* ── TIMELINE ── */
.timeline-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f5f5f5; }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: #e35f14; margin-top: 5px; flex-shrink: 0; }
.timeline-dot.blue  { background: #3b82f6; }
.timeline-dot.green { background: #22c55e; }
.timeline-dot.gray  { background: #d1d5db; }
.timeline-meta { font-size: 11px; color: #aaa; margin-top: 2px; }

/* ── STATUS STEPS ── */
.status-steps { display: flex; margin-bottom: 16px; }
.step { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; font-weight: 600; background: #f5f5f5; color: #bbb; border-right: 1px solid #e8e8e8; transition: all 0.15s; }
.step:first-child { border-radius: 6px 0 0 6px; }
.step:last-child  { border-radius: 0 6px 6px 0; border-right: none; }
.step.active { background: #e35f14; color: #fff; }
.step.done   { background: #22c55e; color: #fff; }

/* ── PHOTOS ── */
.photos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 20px; }
.photo-thumb { aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative; background: #f0f2f5; border: 2px solid transparent; transition: border-color 0.15s; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb:hover { border-color: #e35f14; }
.photo-upload-btn { aspect-ratio: 1; border-radius: 8px; border: 2px dashed #e0e0e0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: #bbb; font-size: 12px; cursor: pointer; transition: border-color 0.15s; background: #fafafa; }
.photo-upload-btn:hover { border-color: #e35f14; color: #e35f14; }

/* ── REPORT WIZARD ── */
.wizard-steps { display: flex; gap: 0; margin-bottom: 28px; }
.wizard-step { flex: 1; text-align: center; padding: 12px 8px; font-size: 12px; font-weight: 600; background: #f5f5f5; color: #bbb; border-right: 1px solid #e8e8e8; position: relative; }
.wizard-step:last-child { border-right: none; }
.wizard-step.active { background: #e35f14; color: #fff; }
.wizard-step.done   { background: #22c55e; color: #fff; }
.wizard-step .step-num { display: block; font-size: 18px; font-weight: 700; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #1a1a2e; }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 380px; }
.login-logo { font-size: 22px; font-weight: 700; color: #e35f14; margin-bottom: 6px; }
.login-sub  { font-size: 13px; color: #888; margin-bottom: 28px; }

/* ── BAR CHART ── */
.bar-chart { padding: 16px 20px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { font-size: 12px; width: 160px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f0f2f5; border-radius: 4px; height: 22px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; background: #e35f14; display: flex; align-items: center; padding-left: 8px; min-width: 30px; }
.bar-fill.blue  { background: #3b82f6; }
.bar-fill.green { background: #22c55e; }
.bar-val { font-size: 11px; font-weight: 700; color: #fff; }

/* ── MISC ── */
.section-title { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
hr.sep { border: none; border-top: 1px solid #f0f0f0; margin: 20px 0; }
.text-muted { color: #aaa; }
.text-small { font-size: 12px; }
.text-orange { color: #e35f14; }
.text-green  { color: #22c55e; }
.text-red    { color: #ef4444; }
.empty { padding: 40px 20px; text-align: center; color: #bbb; font-size: 13px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; background: #f0f2f5; color: #555; border: 1px solid #e0e0e0; margin: 2px; cursor: pointer; transition: all 0.15s; }
.tag:hover, .tag.selected { background: rgba(227,95,20,0.1); color: #e35f14; border-color: #e35f14; }

/* ── HAMBURGER ── */
.sidebar-hamburger {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 200;
    background: #1a1a2e; color: #fff; border: none;
    border-radius: 8px; padding: 8px 12px; font-size: 18px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150;
}
/* Na raport.php chowamy hamburger */
body.wizard-mode .sidebar-hamburger { display: none !important; }

/* ── OFFLINE MODE SHIFT ── */
body.offline-mode .sidebar-hamburger { top: 46px; }
body.offline-mode .topbar { top: 34px; }

/* ── OFFLINE / PWA ── */
.enc-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: #1a1a2e; color: #fff; padding: 10px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 500; z-index: 9999; white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25); transition: transform 0.25s, opacity 0.25s; opacity: 0;
}
.enc-toast.enc-toast-show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── FEEDBACK PANEL ── */
.feedback-btn {
    display: flex; align-items: center; gap: 10px; padding: 10px 18px; cursor: pointer;
    color: rgba(255,255,255,0.4); font-size: 12px; background: none; border: none;
    width: 100%; text-align: left; transition: color 0.15s;
}
.feedback-btn:hover { color: rgba(255,255,255,0.75); }
.feedback-panel {
    position: fixed; left: 228px; bottom: 54px; width: 340px;
    background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    z-index: 300; overflow: hidden;
    opacity: 0; transform: translateX(-8px);
    pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.feedback-panel.open { opacity: 1; transform: translateX(0); pointer-events: auto; }
.feedback-panel-arrow {
    position: absolute; left: -7px; bottom: 24px;
    width: 0; height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 7px solid #fff;
}
.feedback-modal-header {
    padding: 16px 20px 12px; border-bottom: 1px solid #eee;
    display: flex; align-items: center; justify-content: space-between;
}
.feedback-modal-header h3 { font-size: 15px; color: #1a1a2e; }
.feedback-modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: #999; line-height: 1; padding: 0;
}
.feedback-modal-close:hover { color: #333; }
.feedback-modal-body { padding: 16px 20px; }
.feedback-modal-body label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; margin-top: 12px; }
.feedback-modal-body label:first-child { margin-top: 0; }
.feedback-modal-body select, .feedback-modal-body textarea {
    width: 100%; border: 1px solid #ddd; border-radius: 7px;
    padding: 8px 11px; font-size: 13px; font-family: inherit; color: #1a1a2e;
    transition: border-color 0.15s;
}
.feedback-modal-body select:focus, .feedback-modal-body textarea:focus {
    outline: none; border-color: #e35f14;
}
.feedback-modal-body textarea { resize: vertical; min-height: 100px; }
.feedback-modal-footer { padding: 0 20px 16px; display: flex; justify-content: flex-end; }
.feedback-submit {
    background: #e35f14; color: #fff; border: none; border-radius: 7px;
    padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.feedback-submit:hover { background: #c94e0a; }
.feedback-submit:disabled { background: #ccc; cursor: default; }
.feedback-success { text-align: center; padding: 28px 20px; color: #1a1a2e; }
.feedback-success .fs-icon { font-size: 36px; margin-bottom: 10px; }
.feedback-success p { color: #555; font-size: 13px; margin-top: 5px; }

.machine-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.machine-card-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}
.machine-card-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .machine-card-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .machine-card-badges {
        margin-left: 36px;
        flex-wrap: wrap;
    }
    .sidebar { display: none; position: fixed; z-index: 160; }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-main-aside { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .sidebar-hamburger { display: block; }
    body.sidebar-open .sidebar { display: flex; }
    body.sidebar-open .sidebar-overlay { display: block; }
    body.sidebar-open .sidebar-hamburger { display: none; }
    .topbar { padding: 10px 12px 10px 56px; flex-wrap: wrap; gap: 6px; }
    .feedback-panel { left: 12px; right: 12px; bottom: 12px; width: auto; }
    .feedback-panel-arrow { display: none; }

}
