/* ============================================
   Panel Serwisanta - Full Feature Styles
   ============================================ */

/* --- Overlay & Container --- */
.sp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: var(--bg-primary, #0a0e1a);
    overflow-y: auto;
    display: none;
    animation: spFadeIn .3s ease-out;
}
.sp-overlay.active { display: block; }

@keyframes spFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes spSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.sp-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

/* --- Top Bar --- */
.sp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sp-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.sp-topbar-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--ink-100, #f1f5f9);
}
.sp-back-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--ink-300, #94a3b8);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}
.sp-back-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.sp-location-select {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--ink-100, #e2e8f0);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
}
.sp-location-select option { background: #1e293b; color: #e2e8f0; }

/* --- Stats Row --- */
.sp-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.sp-stat-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: spSlideUp .4s ease-out both;
}
.sp-stat-card:nth-child(2) { animation-delay: .05s; }
.sp-stat-card:nth-child(3) { animation-delay: .1s; }
.sp-stat-card:nth-child(4) { animation-delay: .15s; }

.sp-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.sp-stat-icon.teal { background: rgba(20,184,166,.15); color: #14b8a6; }
.sp-stat-icon.blue { background: rgba(59,130,246,.15); color: #3b82f6; }
.sp-stat-icon.orange { background: rgba(249,115,22,.15); color: #f97316; }
.sp-stat-icon.purple { background: rgba(168,85,247,.15); color: #a855f7; }

.sp-stat-info { flex: 1; }
.sp-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ink-100, #f1f5f9);
    line-height: 1;
}
.sp-stat-label {
    font-size: .75rem;
    color: var(--ink-400, #64748b);
    font-weight: 500;
    margin-top: 4px;
}

/* --- Navigation Buttons --- */
.sp-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.sp-nav-btn {
    height: 52px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 700;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .2s;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    letter-spacing: .3px;
}
.sp-nav-btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.sp-nav-btn:active { transform: translateY(0); }
.sp-nav-btn.active { box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0,0,0,.2); }

.sp-btn-add { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.sp-btn-list { background: linear-gradient(135deg, #0369a1, #0ea5e9); }
.sp-btn-complaint { background: linear-gradient(135deg, #c2410c, #f97316); }
.sp-btn-complaints-list { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.sp-btn-commissions { background: linear-gradient(135deg, #7e22ce, #a855f7); }
.sp-btn-deposits { background: linear-gradient(135deg, #0e7490, #06b6d4); }
.sp-btn-points { background: linear-gradient(135deg, #4338ca, #6366f1); }
.sp-btn-employees { background: linear-gradient(135deg, #b45309, #f59e0b); }

/* --- Content Area --- */
.sp-content {
    animation: spSlideUp .35s ease-out;
}

/* --- Glass Card --- */
.sp-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 20px;
}
.sp-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sp-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink-100, #f1f5f9);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-card-body { padding: 24px; }
.sp-card-body.no-pad { padding: 0; }

/* --- Tables --- */
.sp-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ink-200, #e2e8f0);
    font-size: .85rem;
}
.sp-table th {
    background: rgba(255,255,255,.03);
    border-bottom: 2px solid rgba(255,255,255,.08);
    color: var(--ink-400, #64748b);
    font-weight: 600;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .6px;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}
.sp-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    vertical-align: middle;
}
.sp-table tbody tr:hover { background: rgba(255,255,255,.03); }
.sp-table .text-muted { color: var(--ink-500, #475569); font-size: .78rem; }

/* --- Badges --- */
.sp-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
    white-space: nowrap;
}
.sp-badge-new { background: rgba(59,130,246,.15); color: #60a5fa; }
.sp-badge-progress { background: rgba(251,191,36,.15); color: #fbbf24; }
.sp-badge-ready { background: rgba(34,197,94,.15); color: #22c55e; }
.sp-badge-completed { background: rgba(148,163,184,.15); color: #94a3b8; }
.sp-badge-cancelled { background: rgba(239,68,68,.15); color: #ef4444; }
.sp-badge-resolved { background: rgba(34,197,94,.15); color: #22c55e; }
.sp-badge-rejected { background: rgba(239,68,68,.15); color: #ef4444; }
.sp-badge-pending { background: rgba(251,191,36,.15); color: #fbbf24; }
.sp-badge-punkt_sprzedazy { background: rgba(59,130,246,.15); color: #60a5fa; }
.sp-badge-serwis { background: rgba(20,184,166,.15); color: #14b8a6; }

/* --- Status Tracker (Repair Progress) --- */
.sp-status-tracker {
    display: flex;
    align-items: center;
    gap: 4px;
}
.sp-status-step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    position: relative;
}
.sp-status-step.done { background: #22c55e; }
.sp-status-step.current { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,.4); }
.sp-status-line {
    width: 20px;
    height: 2px;
    background: rgba(255,255,255,.08);
}
.sp-status-line.done { background: #22c55e; }

/* --- Forms --- */
.sp-form-group {
    margin-bottom: 16px;
}
.sp-form-label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink-400, #94a3b8);
    margin-bottom: 6px;
}
.sp-form-input, .sp-form-select, .sp-form-textarea {
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--ink-100, #e2e8f0);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .85rem;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.sp-form-input:focus, .sp-form-select:focus, .sp-form-textarea:focus {
    outline: none;
    background: rgba(255,255,255,.08);
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}
.sp-form-textarea { resize: vertical; min-height: 80px; }
.sp-form-select option { background: #1e293b; color: #e2e8f0; }

.sp-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.sp-form-section-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--ink-200, #cbd5e1);
    margin: 20px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

/* --- Buttons --- */
.sp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.sp-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.sp-btn-primary { background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; }
.sp-btn-secondary { background: rgba(255,255,255,.08); color: var(--ink-200, #cbd5e1); border: 1px solid rgba(255,255,255,.1); }
.sp-btn-danger { background: linear-gradient(135deg, #b91c1c, #ef4444); color: #fff; }
.sp-btn-sm { padding: 6px 12px; font-size: .75rem; border-radius: 8px; }
.sp-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--ink-300, #94a3b8);
    cursor: pointer;
    transition: all .2s;
    font-size: .85rem;
}
.sp-btn-icon:hover { background: rgba(255,255,255,.12); color: #fff; }

/* --- Actions Row --- */
.sp-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- News Section --- */
.sp-news-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sp-news-item {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.sp-news-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: rgba(59,130,246,.12);
    color: #60a5fa;
}
.sp-news-text { flex: 1; }
.sp-news-title { font-weight: 600; font-size: .85rem; color: var(--ink-100, #e2e8f0); }
.sp-news-date { font-size: .72rem; color: var(--ink-500, #475569); margin-top: 2px; }

/* --- Tabs for filters --- */
.sp-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding-bottom: 4px;
    overflow-x: auto;
}
.sp-tab {
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink-400, #64748b);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.sp-tab:hover { color: var(--ink-200, #cbd5e1); }
.sp-tab.active {
    color: #14b8a6;
    border-bottom: 2px solid #14b8a6;
    background: rgba(20,184,166,.06);
}

/* --- Search Bar --- */
.sp-search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.sp-search-input {
    flex: 1;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--ink-100, #e2e8f0);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: .82rem;
    font-family: inherit;
}
.sp-search-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20,184,166,.1);
}

/* --- Empty State --- */
.sp-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--ink-500, #475569);
}
.sp-empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.sp-empty-text { font-size: .88rem; }

/* --- Loading Spinner --- */
.sp-loading {
    text-align: center;
    padding: 48px 20px;
}
.sp-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.08);
    border-top-color: #14b8a6;
    border-radius: 50%;
    animation: spSpin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spSpin { to { transform: rotate(360deg); } }

/* --- Modal --- */
.sp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sp-modal-overlay.active { display: flex; }
.sp-modal {
    background: var(--bg-primary, #111827);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: spSlideUp .25s ease-out;
}
.sp-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sp-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--ink-100, #f1f5f9); }
.sp-modal-close {
    background: none;
    border: none;
    color: var(--ink-400, #64748b);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}
.sp-modal-body { padding: 24px; }
.sp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* --- Toast --- */
.sp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    animation: spSlideUp .3s ease-out;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.sp-toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.sp-toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.sp-toast.info { background: linear-gradient(135deg, #2563eb, #3b82f6); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sp-container { padding: 12px 14px 30px; }
    .sp-topbar { flex-direction: column; gap: 10px; align-items: stretch; }
    .sp-nav-grid { grid-template-columns: repeat(2, 1fr); }
    .sp-stats-row { grid-template-columns: 1fr 1fr; }
    .sp-form-row { grid-template-columns: 1fr; }
    .sp-table { font-size: .78rem; }
    .sp-table th, .sp-table td { padding: 10px 10px; }
}

@media (max-width: 480px) {
    .sp-nav-grid { grid-template-columns: 1fr; }
    .sp-stats-row { grid-template-columns: 1fr; }
}
