﻿/* ===== SIDEBAR STYLES (TYLKO DLA ORDER DASHBOARD) ===== */
/* Te style stosują się tylko gdy sidebar jest wewnątrz elementu z klasą order-dashboard */

/* Sidebar - Keep Green like TMP */
/* Ukryj sidebar domyślnie - będzie pokazany tylko na stronie zamówień */
aside.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1b5e20 0%, #2e7d32 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow-y: auto;
    /* 🔧 FIX CLS V2 - contain layout */
    contain: layout style paint;
    will-change: auto;
}

.sidebar-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    min-height: 60px; /* 🔧 FIX CLS */
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.logo i {
    font-size: 1.75rem;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    min-height: 44px; /* 🔧 FIX CLS - stała wysokość */
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: white;
    color: #2e7d32;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    color: white;
    min-width: 28px; /* 🔧 FIX CLS - minimalna szerokość */
    text-align: center;
}

.nav-item.active .nav-badge {
    background: #2e7d32;
    color: white;
}

.nav-section {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    min-height: 20px; /* 🔧 FIX CLS */
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content offset for sidebar - tylko gdy sidebar istnieje */
aside.sidebar + .main-content,
aside.sidebar ~ .main-content {
    margin-left: 280px;
    min-height: 100vh;
}

/* ===== LIST VIEW STYLES ===== */
.list-view {
    display: none;
}

.list-view.active {
    display: block;
}

.list-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
}

.list-item {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.list-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.list-item.priority-high::before {
    background: linear-gradient(180deg, #f43f5e, #ec4899);
}

.list-item.priority-medium::before {
    background: linear-gradient(180deg, #8b5cf6, #a855f7);
}

.list-item.priority-low::before {
    background: linear-gradient(180deg, #10b981, #14b8a6);
}

.list-item:hover {
    background: #f8fafc;
    transform: translateX(4px);
}

.list-item:last-child {
    border-bottom: none;
}

.list-priority {
    width: 80px;
    text-align: center;
    flex-shrink: 0;
}

.list-priority-badge {
    padding: 4px 10px;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.list-number {
    width: 120px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 700;
    flex-shrink: 0;
}

.list-description {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.list-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #475569;
}

.list-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-meta-item i {
    color: #94a3b8;
}

.list-status {
    width: 140px;
    flex-shrink: 0;
}

.list-status-badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    display: block;
}

.status-pending {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.status-waiting {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-progress {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.status-delivered {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.list-value {
    width: 130px;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #6366f1;
    text-align: right;
    flex-shrink: 0;
}

.list-actions {
    width: 100px;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.list-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: #f1f5f9;
    border: none;
    color: #475569;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-action-btn:hover {
    transform: scale(1.1);
}

.list-action-btn.view:hover {
    background: #6366f1;
    color: white;
}

/* ===== TABLE VIEW STYLES ===== */
.table-view {
    display: none;
}

.table-view.active {
    display: block;
}

.table-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #cbd5e1;
}

.data-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: #6366f1;
}

.data-table th.sortable::after {
    content: '?';
    margin-left: 0.5rem;
    opacity: 0.3;
}

.data-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.data-table tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.data-table tbody tr.priority-high::before {
    background: #f43f5e;
}

.data-table tbody tr.priority-medium::before {
    background: #8b5cf6;
}

.data-table tbody tr.priority-low::before {
    background: #10b981;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    color: #0f172a;
}

.data-table td.priority-col {
    width: 100px;
}

.data-table td.number-col {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #94a3b8;
}

.data-table td.description-col {
    max-width: 300px;
}

.table-description {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.table-sub {
    font-size: 0.8rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-sub i {
    color: #94a3b8;
}

.data-table td.value-col {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #6366f1;
    font-size: 1rem;
}

.data-table td.actions-col {
    width: 120px;
    text-align: right;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    aside.sidebar {
        transform: translateX(-100%);
    }
    
    aside.sidebar + .main-content,
    aside.sidebar ~ .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .list-item {
        flex-wrap: wrap;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* ===== LOADING STATES ===== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: #475569;
    font-weight: 500;
}

/* ===== NOTIFICATIONS PANEL ===== */
.notifications-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notifications-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notifications-body {
    max-height: 500px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: all 150ms;
    position: relative;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-content {
    flex: 1;
    cursor: pointer;
}

.dismiss-notification-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
    flex-shrink: 0;
    opacity: 0;
}

.notification-item:hover .dismiss-notification-btn {
    opacity: 1;
}

.dismiss-notification-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
    transform: scale(1.1);
}

.notification-item.urgent {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.05), rgba(236, 72, 153, 0.05));
    border-left: 4px solid #f43f5e;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    flex-shrink: 0;
}

.notification-item.urgent .notification-icon {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.notification-desc {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

.empty-notifications {
    padding: 3rem;
    text-align: center;
    color: #94a3b8;
}

.empty-notifications i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-notifications p {
    margin: 0;
    font-size: 0.95rem;
}

/* ===== DELIVERED VIEW ===== */
.delivered-view {
    display: none;
}

.delivered-view.active {
    display: block;
}

.delivered-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.delivered-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
    transition: all 150ms;
}

.delivered-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.delivered-header {
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.delivered-card.expanded .delivered-header {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border-bottom: 2px solid #10b981;
}

.delivered-info {
    flex: 1;
}

.delivered-number {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.delivered-number i {
    font-size: 1.1rem;
}

.delivered-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.delivered-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #475569;
    flex-wrap: wrap;
}

.delivered-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delivered-meta i {
    color: #94a3b8;
}

.delivered-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.delivered-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.delivered-items {
    font-size: 0.85rem;
    color: #64748b;
}

.expand-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
}

.expand-btn:hover {
    background: #e2e8f0;
}

.delivered-details {
    padding: 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.delivery-info-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.info-item i {
    color: #10b981;
    font-size: 1.1rem;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
}

.positions-table thead {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.positions-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #047857;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.positions-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.positions-table tbody tr:last-child {
    border-bottom: none;
}

.positions-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #0f172a;
}

.positions-table .total-row {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    font-weight: 700;
}

.badge-indeks {
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 4px;
}

.badge-reczny {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 4px;
}

.text-muted {
    color: #94a3b8;
}

.empty-delivered {
    padding: 4rem;
    text-align: center;
    color: #94a3b8;
}

.empty-delivered i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-delivered h3 {
    font-size: 1.5rem;
    color: #475569;
    margin-bottom: 0.5rem;
}

.empty-delivered p {
    font-size: 0.95rem;
}

/* Sidebar - "Raporty" disabled */
.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-badge-soon {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}
