/* ============================================================
   Pokec Manager – UI Components
   ============================================================ */

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: 1px solid transparent; border-radius: var(--radius-md);
    font-family: var(--font-primary); font-size: var(--fs-sm); font-weight: var(--fw-medium);
    cursor: pointer; transition: all var(--transition-fast);
    text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--accent-primary); color: #fff; border-color: var(--accent-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-primary-hover); box-shadow: var(--shadow-glow); transform: translateY(-1px); }

.btn-secondary {
    background: transparent; color: var(--text-secondary); border-color: var(--border-primary);
}
.btn-secondary:hover:not(:disabled) { color: var(--text-primary); border-color: var(--text-secondary); background: var(--bg-card-hover); }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--accent-primary-muted); }

.btn-sm { padding: var(--space-sm) var(--space-md); font-size: var(--fs-xs); }
.btn-lg { padding: var(--space-lg) var(--space-xl); font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { padding: var(--space-md); }

/* === Form Inputs === */
.form-group { margin-bottom: var(--space-lg); }

.form-label {
    display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium);
    color: var(--text-secondary); margin-bottom: var(--space-sm);
}

.form-input, .form-textarea, .form-select {
    width: 100%; padding: var(--space-md) var(--space-lg);
    background: var(--bg-input); border: 1px solid var(--border-primary);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-family: var(--font-primary); font-size: var(--fs-sm);
    transition: all var(--transition-fast); outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--border-focus); background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }

/* === Cards === */
.card {
    background: var(--bg-card); border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg); padding: var(--space-xl);
    transition: all var(--transition-fast);
}
.card:hover { border-color: var(--border-focus); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg); padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-secondary);
}
.card-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }

/* === Stats Grid === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-xl); }

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg); padding: var(--space-xl);
    position: relative; overflow: hidden;
    transition: all var(--transition-fast);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent-primary); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; background: var(--accent-primary);
    opacity: 0; transition: opacity var(--transition-fast);
}
.stat-card:hover::before { opacity: 1; }

.stat-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text-primary); margin-bottom: var(--space-xs); }
.stat-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-icon {
    position: absolute; top: var(--space-lg); right: var(--space-lg);
    width: 40px; height: 40px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-primary-muted); color: var(--accent-primary);
}

/* === Status Indicators === */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
}
.status-dot.active { background: var(--status-active); box-shadow: 0 0 6px var(--status-active); }
.status-dot.online { background: var(--status-online); box-shadow: 0 0 6px var(--status-online); }
.status-dot.away { background: var(--status-away); box-shadow: 0 0 6px var(--status-away); }
.status-dot.offline { background: var(--status-offline); }
.status-dot.unknown { background: var(--text-muted); }

/* === Tables === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-primary); }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: var(--space-md) var(--space-lg);
    font-size: var(--fs-xs); font-weight: var(--fw-semibold);
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.05em; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
}
td {
    padding: var(--space-md) var(--space-lg); font-size: var(--fs-sm);
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-primary);
}
tr:hover td { background: var(--bg-card-hover); }
tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-flex; align-items: center; gap: var(--space-xs);
    padding: 2px 10px; border-radius: var(--radius-full);
    font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.badge-success { background: var(--color-success-muted); color: var(--color-success); }
.badge-warning { background: var(--color-warning-muted); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-muted); color: var(--color-danger); }
.badge-info { background: var(--color-info-muted); color: var(--color-info); }
.badge-neutral { background: var(--bg-input); color: var(--text-secondary); }

/* === Modal === */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: var(--bg-modal-overlay); backdrop-filter: blur(4px);
    z-index: var(--z-modal); align-items: center; justify-content: center;
    padding: var(--space-xl);
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg); width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-xl); border-bottom: 1px solid var(--border-secondary);
}
.modal-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: var(--space-sm); border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); background: var(--accent-primary-muted); }
.modal-body { padding: var(--space-xl); }
.modal-footer {
    display: flex; justify-content: flex-end; gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-secondary);
}

/* === Toast Notifications === */
.toast-container {
    position: fixed; top: var(--space-xl); right: var(--space-xl);
    z-index: var(--z-toast); display: flex; flex-direction: column;
    gap: var(--space-md); pointer-events: none;
}
.toast {
    pointer-events: auto; background: var(--bg-card);
    border: 1px solid var(--border-primary); border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg); min-width: 300px; max-width: 420px;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: flex-start; gap: var(--space-md);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.removing { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }
.toast-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.toast-body { flex: 1; }
.toast-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); margin-bottom: 2px; }
.toast-message { font-size: var(--fs-xs); color: var(--text-secondary); }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info { border-left: 3px solid var(--color-info); }

/* === Theme Toggle === */
.theme-toggle {
    background: var(--bg-input); border: 1px solid var(--border-primary);
    border-radius: var(--radius-full); padding: var(--space-sm) var(--space-md);
    cursor: pointer; color: var(--text-secondary);
    display: flex; align-items: center; gap: var(--space-sm);
    font-size: var(--fs-xs); transition: all var(--transition-fast);
}
.theme-toggle:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.theme-toggle svg { width: 14px; height: 14px; }

/* === Empty State === */
.empty-state {
    text-align: center; padding: var(--space-3xl);
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-lg); opacity: 0.3; }
.empty-state h3 { font-size: var(--fs-md); color: var(--text-secondary); margin-bottom: var(--space-sm); }
.empty-state p { font-size: var(--fs-sm); }

/* === Loading === */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    border-radius: inherit; z-index: 10;
}

/* === Chat Messages === */
.chat-message {
    display: flex; gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.chat-message:hover { background: var(--bg-card-hover); }
.chat-nick {
    font-weight: var(--fw-semibold); font-size: var(--fs-sm);
    color: var(--accent-secondary); cursor: pointer; white-space: nowrap;
    min-width: 100px;
}
.chat-nick:hover { text-decoration: underline; }
.chat-text { font-size: var(--fs-sm); color: var(--text-primary); word-break: break-word; }
.chat-time { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; margin-left: auto; }
.chat-message.hidden-msg { opacity: 0.3; }
