/**
 * Style bazowe
 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-family);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
code { font-family: var(--font-mono); font-size: 0.85em; color: var(--accent-cyan); background: var(--accent-cyan-dim); padding: 2px 6px; border-radius: 4px; }

.hidden { display: none !important; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Ikony */
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Przyciski */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-md);
    font-weight: 500; font-size: 0.9rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.btn--primary {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan));
    color: #000; box-shadow: var(--accent-glow-sm);
}
.btn--primary:hover { box-shadow: var(--accent-glow); transform: translateY(-1px); }
.btn--success { background: #16a34a; color: #fff; }
.btn--success:hover { background: #22c55e; }
.btn--danger { background: rgba(239,68,68,0.2); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn--danger:hover { background: rgba(239,68,68,0.35); }
.btn--ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-default); }
.btn--ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn--sm { padding: 6px 12px; font-size: 0.8rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-loader {
    width: 16px; height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Formularze */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border-default);
    border-radius: var(--radius-md); color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}
.form-input::placeholder { color: var(--text-dim); }
.form-textarea { min-height: 100px; resize: vertical; }

/* Badge */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 20px; font-size: 0.75rem; font-weight: 500;
}
.badge--active { background: rgba(34,197,94,0.15); color: var(--status-active); }
.badge--inactive { background: rgba(239,68,68,0.15); color: var(--status-inactive); }
.badge--archived { background: rgba(139,92,246,0.15); color: var(--status-archived); }
.badge--closed { background: rgba(160,160,168,0.15); color: var(--text-secondary); }
.badge--perm { background: rgba(34,197,94,0.12); color: #4ade80; font-size: 0.7rem; margin: 2px; }

/* Toggle switch */
.toggle {
    position: relative; width: 44px; height: 24px;
    background: var(--bg-elevated); border-radius: 12px;
    cursor: pointer; transition: background var(--transition-fast);
    flex-shrink: 0;
}
.toggle.active { background: var(--accent-cyan); box-shadow: var(--accent-glow-sm); }
.toggle::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; background: #fff; border-radius: 50%;
    transition: transform var(--transition-fast);
}
.toggle.active::after { transform: translateX(20px); }

/* Checkbox custom */
.checkbox-custom {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 8px 12px; border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.checkbox-custom:hover { background: var(--bg-card-hover); }
.checkbox-custom input { display: none; }
.checkbox-custom .check-box {
    width: 18px; height: 18px; border: 2px solid var(--border-default);
    border-radius: 4px; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast); flex-shrink: 0;
}
.checkbox-custom input:checked + .check-box {
    background: var(--accent-cyan); border-color: var(--accent-cyan);
}
.checkbox-custom input:checked + .check-box::after {
    content: '✓'; color: #000; font-size: 12px; font-weight: bold;
}

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute; top: 100%; right: 0; min-width: 160px;
    background: var(--bg-card); border: 1px solid var(--border-default);
    border-radius: var(--radius-md); box-shadow: var(--shadow-card);
    z-index: 100; padding: 4px; margin-top: 4px;
}
.dropdown-item {
    display: block; width: 100%; padding: 8px 12px; text-align: left;
    border-radius: var(--radius-sm); font-size: 0.85rem;
    color: var(--text-secondary); transition: all var(--transition-fast);
}
.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* Shimmer loading */
.shimmer {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Global loader */
.global-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg-overlay); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
}
.loader-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--bg-elevated);
    border-top-color: var(--accent-cyan);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* Toast */
.toast-container {
    position: fixed; top: 16px; right: 16px; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    pointer-events: auto; padding: 12px 20px; border-radius: var(--radius-md);
    background: var(--bg-card); border: 1px solid var(--border-default);
    box-shadow: var(--shadow-card); animation: slideIn 0.3s ease;
    display: flex; align-items: center; gap: 10px; min-width: 280px;
}
.toast--success { border-left: 3px solid var(--status-active); }
.toast--error { border-left: 3px solid var(--status-inactive); }
.toast--info { border-left: 3px solid var(--accent-cyan); }
.toast--warning { border-left: 3px solid var(--status-warning); }
