/* ============================================
   Faktury KSeF - System weryfikacji faktur
   ============================================ */

:root {
    --primary: #2563EB;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand { color: white; text-decoration: none; font-weight: 700; font-size: 18px; }
.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.15); color: white; }
.nav-logout { border-left: 1px solid rgba(255,255,255,0.2); margin-left: 8px; }
.nav-user { color: rgba(255,255,255,0.7); font-size: 13px; padding: 0 8px; }
.nav-lang { display: flex; gap: 0; }

/* Main content */
.main-content { flex: 1; padding: 24px 20px; }

/* Auth */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
}
.auth-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-title { text-align: center; color: var(--primary); font-size: 28px; margin-bottom: 8px; }
.auth-subtitle { text-align: center; color: var(--gray-500); margin-bottom: 24px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

/* Forms */
.form-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    max-width: 700px;
}
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--gray-700); }
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-hint { display: block; color: var(--gray-500); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.inline-form { display: inline; }
.radio-group { display: flex; gap: 20px; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; padding: 10px 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { background: var(--gray-100); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    border-top: 3px solid var(--primary);
}
.stat-card.stat-warning { border-top-color: var(--warning); }
.stat-card.stat-success { border-top-color: var(--success); }
.stat-card.stat-error { border-top-color: var(--danger); }
.stat-value { font-size: 36px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 13px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.table th {
    background: var(--gray-50);
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}
.table td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}
.table tbody tr:hover { background: var(--gray-50); }
.table-compact td, .table-compact th { padding: 8px 10px; font-size: 13px; }
.table-footer td { font-size: 14px; background: var(--gray-50); border-top: 2px solid var(--gray-200); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.col-check { width: 40px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fef2f2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-default { background: var(--gray-100); color: var(--gray-700); }

/* Sections */
.section { margin-top: 32px; }
.section h2 { font-size: 20px; margin-bottom: 16px; color: var(--gray-700); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header h1 { font-size: 24px; }

/* Batch Cards */
.batch-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--gray-300);
}
.batch-card.batch-pending { border-left-color: var(--warning); }
.batch-card.batch-done { border-left-color: var(--success); }
.batch-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.batch-card-header h3 { margin: 0; }
.batch-info { background: white; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }

/* Bulk Actions */
.bulk-actions { margin-bottom: 16px; }
.bulk-bar {
    background: white;
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* Action Buttons */
.action-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* Invoice row status */
.invoice-row.status-accepted { background: #f0fdf4; }
.invoice-row.status-rejected { background: #fef2f2; }

/* Info & Result cards */
.info-card, .result-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.error-list { list-style: none; padding: 0; }
.error-list li { padding: 4px 0; color: var(--danger); font-size: 13px; }
.error-list li::before { content: "• "; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-500);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
}
.modal-content h3 { margin-bottom: 12px; }

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 16px 0;
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu { flex-wrap: wrap; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .section-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .table { font-size: 13px; }
    .table td, .table th { padding: 8px 6px; }
    .bulk-bar { flex-wrap: wrap; }
}
