/* === COMPONENTS.CSS ===
 * assets/css/components.css
 * НАЗНАЧЕНИЕ: Стили базовых UI компонентов (кнопки, карточки, формы, модалки)
 * СВЯЗИ: index.php, auth.css, dashboard.css
 * РАЗМЕР: ~620 строк
 */

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1;
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.9);
}

/* Secondary Button */
.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover:not(:disabled) {
    background: hsl(var(--secondary) / 0.9);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.btn-outline:hover:not(:disabled) {
    background: hsl(var(--accent));
    border-color: hsl(var(--accent));
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover:not(:disabled) {
    background: hsl(var(--accent));
}

/* Hero Button (Gradient) */
.btn-hero {
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
    color: white;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    box-shadow: 0 4px 15px hsl(var(--primary) / 0.3);
}

.btn-hero:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
    transform: translateY(-2px);
}

/* Hero Outline Button */
.btn-hero-outline {
    background: transparent;
    border: 1px solid hsl(var(--primary));
    color: hsl(var(--primary));
    padding: 0.875rem 1.5rem;
}

.btn-hero-outline:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.1);
}

/* Destructive Button */
.btn-destructive {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover:not(:disabled) {
    background: hsl(var(--destructive) / 0.9);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-xl {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-icon {
    padding: 0.625rem;
    width: 2.5rem;
    height: 2.5rem;
}

/* White Button (for dark backgrounds) */
.btn-white {
    background: white;
    color: hsl(var(--background));
    font-weight: 600;
}

.btn-white:hover:not(:disabled) {
    background: hsl(0 0% 95%);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px hsl(var(--primary) / 0.1);
    border-color: hsl(var(--primary) / 0.3);
}

.card-gradient {
    background: linear-gradient(135deg, hsl(var(--card)) 0%, hsl(var(--primary) / 0.05) 100%);
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.card-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.card-content {
    /* Content area */
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid hsl(var(--border));
}

/* ============================================
   INPUTS
   ============================================ */
.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    background: hsl(var(--surface-1));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

.input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-error {
    border-color: hsl(var(--destructive));
}

.input-error:focus {
    box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.1);
}

/* Textarea */
.textarea {
    min-height: 100px;
    resize: vertical;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.badge-default {
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.2);
}

.badge-secondary {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

.badge-success {
    background: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
    border-color: hsl(var(--success) / 0.2);
}

.badge-warning {
    background: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
    border-color: hsl(var(--warning) / 0.2);
}

.badge-destructive {
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.2);
}

.badge-glow {
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.3);
    box-shadow: 0 0 10px hsl(var(--primary) / 0.2);
}

/* ============================================
   DIALOGS / MODALS
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: hsl(var(--background) / 0.8);
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-backdrop.active {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    z-index: 51;
    max-width: 500px;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    border-radius: var(--radius);
    transition: color 0.2s ease, background 0.2s ease;
}

.modal-close:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--muted));
}

.modal-body {
    color: hsl(var(--muted-foreground));
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 10px 40px hsl(0 0% 0% / 0.2);
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.toast-success {
    border-left: 3px solid hsl(var(--success));
}

.toast-error {
    border-left: 3px solid hsl(var(--destructive));
}

.toast-warning {
    border-left: 3px solid hsl(var(--warning));
}

.toast-info {
    border-left: 3px solid hsl(var(--primary));
}

.toast-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 500;
    color: hsl(var(--foreground));
}

.toast-message {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.toast-close {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    border-radius: var(--radius);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: 0 10px 40px hsl(0 0% 0% / 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 40;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: hsl(var(--muted));
}

.dropdown-item-destructive {
    color: hsl(var(--destructive));
}

.dropdown-separator {
    height: 1px;
    background: hsl(var(--border));
    margin: 0.5rem 0;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid hsl(var(--border));
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tab:hover {
    color: hsl(var(--foreground));
}

.tab.active {
    color: hsl(var(--primary));
    border-bottom-color: hsl(var(--primary));
}

.tab-content {
    display: none;
    padding: 1rem 0;
}

.tab-content.active {
    display: block;
}

/* ============================================
   AVATAR
   ============================================ */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

/* ============================================
   SEPARATOR & SPINNER & UTILITIES
   ============================================ */
.separator {
    height: 1px;
    background: hsl(var(--border));
    margin: 1rem 0;
}

.separator-vertical {
    width: 1px;
    height: 100%;
    background: hsl(var(--border));
    margin: 0 1rem;
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
}

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

/* Width/Height utilities */
.w-full { width: 100%; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }

.text-primary { color: hsl(var(--primary)); }
.text-destructive { color: hsl(var(--destructive)); }
