/* ============================================================
   ABAPP2 — wspólny design system (MJT-1041, Etap 1)
   Tokeny + komponenty wyciągnięte 1:1 z index.html.
   Linkowane przez: index.html, login.html (+ rotation-inbox w server.js).
   (automations.html usunięty w MJT-1251 — zakładka żyje w SPA.)
   Style specyficzne dla strony zostają inline w każdej stronie.
   UWAGA deploy: nowy plik — musi trafić na prod razem ze
   zmienionymi index.html / login.html.
   ============================================================ */

/* Lucide icons base styling */
[data-lucide] {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    display: inline-block;
}
.nav-item [data-lucide] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ios-blue: #0A84FF;
    --ios-blue-hover: #409CFF;
    --success-green: #30D158;
    --success-green-hover: #32D74B;
    --system-gray: #1c1c1e;
    --system-gray-2: #2c2c2e;
    --system-gray-3: #38383a;
    --system-gray-4: #48484a;
    --system-gray-5: #636366;
    --system-gray-6: #98989d;
    --text-primary: #ffffff;
    --text-secondary: #98989d;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --card-shadow-hover: rgba(0, 0, 0, 0.5);
    --sidebar-bg: rgba(28, 28, 30, 0.95);
    --warning-orange: #FF9F0A;
    --error-red: #FF453A;
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --card-bg: #1c1c1e;
    --text-tertiary: #636366;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--system-gray-3);
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--system-gray-4);
    border-radius: 3px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 32px;
    padding: 8px 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--system-gray);
}

.nav-item.active {
    background: var(--ios-blue);
    color: white;
}

/* Collapsible nav group */
.nav-group {}

.nav-group-toggle {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-group-toggle:hover {
    background: var(--system-gray);
}

.nav-group-toggle [data-lucide] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.nav-group-toggle .nav-group-chevron {
    margin-left: auto;
    margin-right: 0;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav-group.open .nav-group-toggle .nav-group-chevron {
    transform: rotate(90deg);
}

.nav-group.open .nav-group-toggle {
    color: var(--ios-blue);
}

.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-group.open .nav-group-items {
    max-height: 500px;
}

.nav-group-items .nav-item {
    padding-left: 42px;
    font-size: 14px;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 24px;
    min-height: 100vh;
}

.store-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.store-badge[data-store="walkingpad.pl"] { background: #007AFF; }
.store-badge[data-store="ebiker.pl"] { background: #FF9500; }
.store-badge[data-store="reactor.bike"] { background: #34C759; }
.store-badge[data-store="rapidebike"], .store-badge[data-store="b2b.rapidebike.com"] { background: #8E8E93; }
.store-badge[data-store="reactor.energy"] { background: #5856D6; }
.store-badge[data-store="ebidet.pl"] { background: #AF52DE; }
.store-badge[data-store="runpad.eu"] { background: #FF2D55; }
.store-badge[data-store="getbitelab.com"] { background: #00C7BE; }
.store-badge[data-store="mediamarkt_mirakl"] { background: #FF3B30; }
.store-badge[data-store="allegro"] { background: #FFD60A; color: #1C1C1E; }

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.paid {
    background: rgba(48, 209, 88, 0.25);
    color: #30D158;
}

.status-badge.pending {
    background: rgba(255, 159, 10, 0.25);
    color: #FF9F0A;
}

.status-badge.fulfilled {
    background: rgba(10, 132, 255, 0.25);
    color: #0A84FF;
}

.status-badge.unfulfilled {
    background: rgba(255, 69, 58, 0.25);
    color: #FF453A;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-card {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--system-gray-3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--system-gray-3);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--error-red);
    margin-left: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px 24px;
    border-top: 1px solid var(--system-gray-3);
}

.modal-button {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.modal-button.secondary {
    background: var(--system-gray-2);
    color: var(--text-primary);
}

.modal-button.secondary:hover {
    background: var(--system-gray-3);
}

.modal-button.primary {
    background: var(--ios-blue);
    color: white;
}

.modal-button.primary:hover:not(:disabled) {
    background: var(--ios-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.modal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-error {
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid var(--error-red);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

.modal-error-title {
    color: var(--error-red);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
}

.modal-error-message {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

/* ============================================================
   Etap 3 (MJT-1047) — spójność widoków SPA
   Jeden wzorzec nagłówka strony, jedna klasa tabeli,
   jeden zestaw przycisków. Wzorzec = styl reklamacji/zleceń
   (post-lifting, MJT-1040 decyzja: ciemny iOS).
   Widoki dodają klasy .page-title/.page-subtitle OBOK swoich
   legacy klas (hooki JS zostają) — te reguły wygrywają
   specyficznością (.page-content .page-title = 0,2,0).
   ============================================================ */

.page-content .page-title {
    font-size: 25px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 5px;
    letter-spacing: -0.55px;
}
.page-content .page-title::after {
    content: '';
    display: block;
    width: 44px;
    height: 3px;
    margin-top: 8px;
    border-radius: 2px;
    background: linear-gradient(90deg, #0a84ff, #5e5ce6 70%, transparent);
}
.page-content .page-subtitle {
    font-size: 13px;
    color: var(--system-gray-6);
    margin: 10px 0 20px;
    max-width: 720px;
    line-height: 1.5;
}

/* Jeden zestaw przycisków */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ios-blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--ios-blue-hover); }
.btn-success { background: var(--success-green); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success-green-hover); }
.btn-danger { background: var(--error-red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #FF6961; }
.btn-secondary { background: var(--system-gray-3); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--system-gray-4); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--system-gray-3); }
.btn-ghost:hover:not(:disabled) { background: var(--system-gray-2); color: var(--text-primary); }

/* Jedna klasa tabeli */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--system-gray-3);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
