/**
 * WP PANEL v2 - Kompaktowy UI
 * Inspiracja: Gęsty layout z małymi fontami, sidebar, tabele
 */

/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Colors */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Spacing */
    --sidebar-width: 220px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--gray-900);
    background: var(--gray-50);
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   LAYOUT
   ======================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.nav-item .icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.sidebar-footer a {
    color: rgba(255,255,255,0.8);
}

/* ========================================
   CONTENT
   ======================================== */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.content-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.content-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.content-header .breadcrumb {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.content-header .actions {
    display: flex;
    gap: 10px;
}

.content-body {
    flex: 1;
    padding: 20px 25px;
}

/* ========================================
   FILTERS (Kompaktowe)
   ======================================== */
.filters {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filters label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

/* ========================================
   FORM INPUTS (Kompaktowe)
   ======================================== */
.input-sm,
.select-sm,
.textarea-sm {
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-sm {
    min-width: 150px;
}

.input-sm:focus,
.select-sm:focus,
.textarea-sm:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.textarea-sm {
    min-height: 80px;
    resize: vertical;
}

/* ========================================
   BUTTONS
   ======================================== */

/* Base button styles */
.btn,
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 6px;
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:hover,
.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn:active,
.btn-sm:active {
    transform: translateY(0);
}

/* Primary button */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #2563eb;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

/* Success button */
.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

/* Warning button */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #d97706;
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 8px rgba(217, 119, 6, 0.3);
}

/* Danger button */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #dc2626;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* Secondary button */
.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

/* Icon button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    color: var(--gray-600);
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    transform: scale(1.1);
}

/* Disabled state */
.btn:disabled,
.btn-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Button sizes */
.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

/* ========================================
   TABLE (Kompaktowa)
   ======================================== */
.table-wrapper {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.compact-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.compact-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-700);
    white-space: nowrap;
}

.compact-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.compact-table tbody tr:last-child td {
    border-bottom: none;
}

.compact-table tbody tr:hover {
    background: var(--gray-50);
}

.compact-table td.actions {
    display: flex;
    gap: 4px;
}

.compact-table td.center {
    text-align: center;
}

.compact-table td.right {
    text-align: right;
}

/* Table links - klikalne liczby w tabelach */
.table-link {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.table-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* ========================================
   BADGE (Status indicators)
   ======================================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1.6;
    white-space: nowrap;
}

.badge.success {
    background: #d1fae5;
    color: #065f46;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.badge.gray {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ========================================
   CARD
   ======================================== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--gray-900);
}

/* ========================================
   STATS (Dashboard kompaktowy)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 15px;
}

.stat-card .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 5px 0;
}

.stat-card .subtext {
    font-size: 12px;
    color: var(--gray-600);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.alert.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.alert.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

/* ========================================
   PAGINATION (Kompaktowa)
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 5px 10px;
    font-size: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
    color: var(--gray-700);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--gray-50);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========================================
   TOOLTIPS
   ======================================== */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: var(--gray-900);
    color: white;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE (optional - desktop first)
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
