/* ============================================
   ASSISEEK — ОБЩИЕ КОМПОНЕНТЫ
   Версия 3.1
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-primary: #0a0a0f;
    --bg-secondary: #13151a;
    --bg-card: rgba(18, 20, 36, 0.88);
    --bg-hover: rgba(99, 102, 241, 0.08);
    --bg-active: rgba(99, 102, 241, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a5b7;
    --text-muted: #6b7280;
    
    --border-color: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
    
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== ГРАДИЕНТНЫЙ ФОН ===== */
.gradient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: 
        radial-gradient(ellipse 80% 60% at 15% 20%, rgba(99, 102, 241, 0.18), transparent 55%),
        radial-gradient(ellipse 60% 50% at 85% 75%, rgba(139, 92, 246, 0.12), transparent 50%),
        radial-gradient(ellipse at 50% 50%, #12121f 0%, #0a0a0f 70%);
}

.gradient-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent);
    opacity: 0.35;
    pointer-events: none;
}

/* ===== ШАПКА ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 14px 0;
    background: transparent;
}

@media (min-width: 768px) {
    .site-header {
        padding: 14px 20px 0;
    }
}

.navbar-glass {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.55rem 1rem;
    background: rgba(12, 14, 24, 0.82);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (min-width: 768px) {
    .navbar-glass {
        padding: 0.5rem 1.25rem;
        border-radius: 20px;
    }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
}

.navbar-brand img {
    height: 28px;
    width: auto;
}

@media (min-width: 768px) {
    .navbar-brand img {
        height: 32px;
    }
}

.navbar-brand span {
    background: linear-gradient(135deg, #ffffff, #a5b4fc, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.1rem;
}

.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: white;
    font-size: 1.2rem;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0.75rem 0;
        gap: 2px;
    }
    .nav-links.open {
        display: flex;
    }
}

.nav-links a {
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.4rem 0.65rem;
    border-radius: 10px;
    transition: var(--transition);
}

.nav-links a:hover {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.1);
}

.nav-links a.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
}

@media (max-width: 768px) {
    .nav-links a {
        width: 100%;
        text-align: center;
        padding: 0.5rem;
        border-radius: 8px;
    }
}

.btn-primary-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    border: none;
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.88rem;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.32);
    display: inline-block;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.42);
    color: #fff;
}

@media (max-width: 768px) {
    .btn-primary-gradient {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ===== КОНТЕЙНЕР ===== */
.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
    flex: 1;
    width: 100%;
}

@media (min-width: 768px) {
    .container {
        margin: 2rem auto;
        padding: 0 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
        margin: 0.5rem auto;
    }
}

/* ===== СТЕКЛЯННАЯ КАРТОЧКА ===== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
    .glass-card {
        padding: 2rem;
        margin-bottom: 2rem;
        border-radius: var(--radius-xl);
    }
}

@media (max-width: 768px) {
    .glass-card {
        padding: 1rem;
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 0.75rem;
        border-radius: var(--radius-sm);
        margin-bottom: 0.75rem;
    }
}

.glass-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.glass-card h3 i {
    color: var(--primary);
}

@media (max-width: 768px) {
    .glass-card h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .glass-card h3 {
        font-size: 0.9rem;
    }
}

.glass-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

@media (max-width: 480px) {
    .glass-card .subtitle {
        font-size: 0.8rem;
    }
}

/* ===== СЕКЦИЯ ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.section-header h3 i {
    color: var(--primary);
}

.section-header .badge {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== ФОРМЫ ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .form-control {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    .form-label {
        font-size: 0.8rem;
    }
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== КНОПКИ ===== */
.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
    .btn-cancel {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 0.6rem 1.8rem;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .btn-submit {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-action:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-action.danger {
    color: var(--danger);
}

.btn-action.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

/* ===== КНОПКА СОЗДАНИЯ ЧАТА С PULSE ===== */
.create-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    width: 100%;
    max-width: 220px;
    min-height: 48px;
}

.create-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
}

.create-chat-btn:active {
    transform: scale(0.96);
}

.create-chat-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.create-chat-btn:hover i {
    transform: rotate(90deg);
}

.create-chat-btn.pulse {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(99, 102, 241, 0.6); }
}

/* ===== ЗАКРЕПЛЁННЫЙ ЧАТ ===== */
.pin-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-size: 12px;
    opacity: 0.4;
    min-width: 28px;
    min-height: 28px;
}

.history-item:hover .pin-btn {
    opacity: 1;
}

.pin-btn:hover {
    color: var(--warning);
}

.pin-btn.pinned {
    color: var(--warning);
    opacity: 1;
}

.pin-btn.pinned i {
    transform: rotate(-45deg);
}

/* ===== МОДАЛКИ ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.modal-header h3 i {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    .modal-footer {
        flex-direction: column;
    }
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
}

.toast {
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}
.toast.error {
    border-left: 4px solid var(--danger);
}
.toast.info {
    border-left: 4px solid var(--info);
}
.toast.warning {
    border-left: 4px solid var(--warning);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-content {
    flex: 1;
    font-size: 0.85rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

/* ===== ПУСТЫЕ СОСТОЯНИЯ ===== */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
    font-weight: 500;
}

.empty-state span {
    font-size: 0.85rem;
}

.loading-state {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== СКРОЛЛБАР ===== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== ВЫДЕЛЕНИЕ ===== */
::selection {
    background: var(--primary);
    color: white;
}

/* ===== ОТКЛЮЧЕНИЕ АНИМАЦИЙ ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}