/* Zamawiarka BOOSTNET v2.0 - Modern CSS - OPTIMIZED COMPACT VERSION */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --light-gray: #f8fafc;
    --dark-gray: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 0.5rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--dark-gray);
    background-color: var(--light-gray);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    max-width: 1600px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.navbar-brand {
    color: white;
    font-size: var(--font-size-xl);
    font-weight: 700;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Main Content */
.main-content {
    padding: 1rem 0;
    min-height: calc(100vh - 80px);
}

.page-header {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--secondary-color);
    font-size: 0.95rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

.card-header {
    background: var(--light-gray);
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #047857;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #b45309;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-weight: 500;
    color: var(--dark-gray);
    font-size: 0.9rem;
}

.form-input {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    background-color: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
    font-size: 0.85rem;
}

.table th,
.table td {
    padding: 0.5rem 0.375rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--dark-gray);
    position: sticky;
    top: 0;
    font-size: 0.8rem;
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.table-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
    min-width: 120px;
}

/* Specjalne klasy dla kolumn */
.col-kto { min-width: 100px; max-width: 120px; }
.col-co { min-width: 200px; max-width: 300px; overflow: hidden; }
.col-data { min-width: 90px; max-width: 100px; }
.col-cena { min-width: 80px; max-width: 120px; overflow: hidden; }
.col-marza { min-width: 80px; max-width: 120px; overflow: hidden; }
.col-uwagi { min-width: 150px; max-width: 200px; overflow: hidden; }
.col-przyjechalo { min-width: 100px; max-width: 120px; overflow: hidden; }
.col-fv-typ { min-width: 80px; max-width: 100px; }
.col-fv-par { min-width: 80px; max-width: 100px; }
.col-status { min-width: 100px; max-width: 120px; }
.col-akcje { min-width: 120px; width: 120px; }

/* Kompaktowy widok tabeli */
.table-compact .table th,
.table-compact .table td {
    padding: 0.375rem 0.25rem;
    font-size: 0.85rem;
}

.table-compact .card-header {
    padding: 0.5rem 1rem;
}

.table-dense {
    line-height: 1.3;
}

.table-dense th,
.table-dense td {
    padding: 0.25rem 0.375rem;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fecaca;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: var(--success-color);
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border-color: var(--primary-color);
    color: #1e40af;
}

/* Filter Menu */
.filter-menu {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-link {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-link:hover,
.filter-link.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--dark-gray);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.input-with-icon {
    padding-left: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    body {
        font-size: 0.85rem;
    }
    
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-header {
        padding: 1rem;
        text-align: center;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.75rem;
    }
    
    .table {
        min-width: 800px;
    }
    
    .table th,
    .table td {
        padding: 0.375rem 0.25rem;
    }
    
    .btn-group {
        justify-content: center;
    }
    
    .filter-menu {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .filter-link {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    @media (max-width: 480px) {
        .col-data,
        .col-fv-typ,
        .col-fv-par {
            display: none;
        }
        
        .table {
            min-width: 600px;
        }
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1800px;
    }
    
    .table {
        font-size: 0.85rem;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Row highlighting for completed orders */
.completed-row {
    background-color: #f0fdf4 !important;
    opacity: 0.8;
}

.completed-row:hover {
    background-color: #dcfce7 !important;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus states for accessibility */
.btn:focus,
.form-input:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .filter-menu {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .table {
        font-size: 12px;
    }
}

/* Email buttons */
.email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    min-width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-weight: 500;
}

.email-not-sent {
    background-color: var(--danger-color);
    color: white;
}

.email-not-sent:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.email-sent {
    background-color: var(--success-color);
    color: white;
}

.email-sent:hover {
    background-color: #047857;
    transform: translateY(-1px);
}

.email-error {
    background-color: var(--warning-color);
    color: white;
}

.email-error:hover {
    background-color: #b45309;
    transform: translateY(-1px);
}

.email-btn.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.email-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.email-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.email-btn i {
    font-size: 0.875rem;
    line-height: 1;
}

.table-actions .btn,
.table-actions .email-btn {
    min-width: 32px;
    height: 32px;
    padding: 0.375rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .email-btn {
        min-width: 28px;
        height: 28px;
        padding: 0.25rem 0.375rem;
        font-size: 0.7rem;
    }
    
    .email-btn i {
        font-size: 0.75rem;
    }
}

/* Kolumna avatar */
.col-avatar {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center;
    padding: 0.5rem 0.25rem !important;
}

/* Avatar użytkownika */
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.disabled-action {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.user-avatar[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-gray);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .col-avatar {
        width: 35px;
        min-width: 35px;
        max-width: 35px;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .col-avatar {
        width: 30px;
        min-width: 30px;
        max-width: 30px;
    }
    
    .user-avatar {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
        border-width: 1px;
    }
}

.user-avatar {
    animation: avatarFadeIn 0.3s ease;
}

@keyframes avatarFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sekcja wyboru metody cenowej */
.pricing-method-selector {
    margin-top: 0.375rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.02);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radio-content {
    flex: 1;
}

.radio-content strong {
    display: block;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.radio-content small {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Input z sufiksem (zł lub %) */
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    padding-right: 3rem;
}

.input-suffix {
    position: absolute;
    right: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
    pointer-events: none;
    font-size: 0.9rem;
}

/* Informacje o kalkulacji */
.price-info {
    margin-top: 0.375rem;
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.calculation-display {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    display: block;
}

input[readonly] {
    background-color: #f8fafc !important;
    cursor: not-allowed;
}

/* Animacje dla grup pól */
.narzut-input-group {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.narzut-input-group[style*="block"] {
    opacity: 1;
    max-height: 200px;
}

@media (max-width: 768px) {
    .radio-group {
        gap: 0.5rem;
    }
    
    .radio-option {
        padding: 0.75rem;
    }
    
    .radio-content strong {
        font-size: 0.9rem;
    }
    
    .radio-content small {
        font-size: 0.8rem;
    }
}

.radio-content strong::before {
    margin-right: 0.5rem;
}

.radio-option:has(input:checked) {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.1);
}

.price-info:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.calculation-display {
    transition: color 0.2s ease;
}

.calculation-display.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { color: transparent; }
    40% { color: var(--secondary-color); }
    100% { color: transparent; }
}

.supplier-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.supplier-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.custom-supplier-group {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
    }
}

.supplier-select option[value="allegro"]::before { content: "🛒 "; }
.supplier-select option[value="amazon"]::before { content: "📦 "; }
.supplier-select option[value="aliexpress"]::before { content: "🇨🇳 "; }
.supplier-select option[value="local_supplier"]::before { content: "🏪 "; }
.supplier-select option[value="other"]::before { content: "❓ "; }

/* Różnica marży - rozszerzone kalkulacje */
.margin-difference {
    margin: 1rem 0 !important;
}

.margin-difference > div {
    padding: 1rem !important;
}

.profit-box {
    padding: 0.75rem !important;
}

.copy-profit-btn {
    transition: all 0.2s ease;
}

.copy-profit-btn:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: scale(1.05) !important;
}

/* Dodatkowa optymalizacja dla dużych ekranów */
@media (min-width: 1600px) {
    .container {
        max-width: 2000px;
    }
    
    .navbar-content {
        max-width: 1800px;
    }
}

/* Status badges w tabeli */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-nie-zamowione {
    background-color: #fef3c7;
    color: #92400e;
}

.status-zamowione {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-przyjechalo {
    background-color: #dcfce7;
    color: #166534;
}

.status-custom {
    background-color: #f3f4f6;
    color: #374151;
}

/* Text truncate with hover tooltip */
.text-truncate-hover {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* Required field indicator */
.required {
    color: var(--danger-color);
    font-weight: bold;
}

.field-info {
    color: var(--secondary-color);
    font-weight: normal;
    font-size: 0.8rem;
}