/* Основные переменные */
:root {
    --primary-color: #9b59b6;
    --primary-dark: #8e44ad;
    --secondary-color: #e67e22;
    --accent-color: #f39c12;
    --dark-bg: #0f0f1a;
    --darker-bg: #0a0a0f;
    --card-bg: rgba(30, 30, 45, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0b0;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --glow-shadow: 0 0 20px rgba(155, 89, 182, 0.3);

    /* Переопределение Bootstrap переменных */
    --bs-body-color: var(--text-primary);
    --bs-body-bg: var(--dark-bg);
    --bs-link-color: #c77dff;
    --bs-link-hover-color: #e09dff;
    --bs-btn-color: #ffffff;
    --bs-btn-hover-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Мистический фон со звёздами */
.stars, .twinkling {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1;
}

.stars {
    background: var(--darker-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cdefs%3E%3CradialGradient id='star'%3E%3Cstop offset='90%25' stop-color='%23fff' stop-opacity='0.8'/%3E%3Cstop offset='100%25' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='%230a0a0f'/%3E%3C/svg%3E") repeat;
    background-size: 200px 200px;
}

.twinkling {
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cdefs%3E%3CradialGradient id='star2'%3E%3Cstop offset='90%25' stop-color='%23fff' stop-opacity='0.6'/%3E%3Cstop offset='100%25' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='transparent'/%3E%3C/svg%3E") repeat;
    background-size: 300px 300px;
    animation: twinkle 200s linear infinite;
}

@keyframes twinkle {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}

/* Навигация */
.navbar {
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    text-decoration: none;
}

.navbar-brand::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.3s ease;
}

.navbar-brand:hover::after {
    width: 100%;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary) !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--gradient-1);
    border-radius: 2px;
}

.navbar-toggler {
    border: none;
    color: var(--text-primary);
    background: transparent;
}

.navbar-toggler i {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Пользовательское меню */
.nav-user {
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border-radius: 50px;
    transition: all 0.3s ease;
    color: var(--text-primary) !important;
    text-decoration: none;
}

.nav-user:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    color: var(--text-primary) !important;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
    color: white;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* Кнопки */
.btn {
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-glow {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary) !important;
    border-radius: 50px;
    padding: 0.5rem 1.25rem;
}

.btn-outline-glow:hover {
    border-color: var(--primary-color);
    background: rgba(155, 89, 182, 0.1);
    color: var(--text-primary) !important;
    box-shadow: var(--glow-shadow);
    transform: translateY(-1px);
}

.btn-primary-glow {
    background: var(--gradient-1);
    border: none;
    color: white !important;
    border-radius: 50px;
    padding: 0.5rem 1.25rem;
    position: relative;
    overflow: hidden;
}

.btn-primary-glow:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-shadow);
    color: white !important;
}

.btn-primary-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary-glow:hover::before {
    left: 100%;
}

/* Ссылки */
a {
    color: #c77dff;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #e09dff;
    text-decoration: none;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Карточки */
.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-shadow);
    border-color: rgba(155, 89, 182, 0.3);
}

.card-title {
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
}

.card-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.card-header h5, .card-header h6 {
    color: var(--text-primary);
}

/* Flash сообщения */
.flash-message {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.footer {
    background: rgba(10, 10, 15, 0.95);
    border-top: 1px solid var(--glass-border);
    margin-top: 3rem;
    color: var(--text-secondary);
}

.footer-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.footer-heading {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--glass-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    color: white;
}

/* Кнопка быстрого вопроса */
.quick-question-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-1);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.quick-question-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-shadow);
    color: white;
}

.quick-question-btn .tooltip-text {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.quick-question-btn:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
    right: 80px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(155, 89, 182, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(155, 89, 182, 0);
    }
}

/* Модальное окно */
.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    color: var(--text-primary);
}

.modal-header {
    border-bottom-color: var(--glass-border);
}

.modal-footer {
    border-top-color: var(--glass-border);
}

.modal-glow {
    animation: modalGlow 0.5s ease;
}

@keyframes modalGlow {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Формы */
.form-control, .form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(155, 89, 182, 0.25);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-secondary);
}

/* Dropdown */
.dropdown-menu {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.dropdown-item {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.dropdown-divider {
    border-top-color: var(--glass-border);
}

/* Адаптивность */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }

    .nav-user .user-name {
        display: none;
    }

    .quick-question-btn {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--darker-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Выделение текста */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    opacity: 1 !important;
    transform: translateY(0) !important;
    animation: fadeInUp 0.6s ease forwards;
}

/* Alert */
.alert {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.alert-success {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.3);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.3);
}

.alert-warning {
    background: rgba(241, 196, 15, 0.2);
    border-color: rgba(241, 196, 15, 0.3);
}

.alert-info {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.3);
}

.user-balance {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    color: #ffd700;
    white-space: nowrap;
}

.user-balance i {
    font-size: 0.7rem;
    margin-right: 2px;
}

.mobile-balance {
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border-radius: 0.5rem;
    color: var(--text-primary);
}

.rating-stars-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.25rem;
}

.rating-stars-input input {
    display: none;
}

.rating-stars-input label {
    cursor: pointer;
    font-size: 1.8rem;
    color: #6c757d;
    transition: color 0.2s ease, transform 0.2s ease;
}

.rating-stars-input label i {
    transition: color 0.2s ease;
    color: #6c757d;
}

/* Заливка звёзд при наведении и выборе */
.rating-stars-input input:checked ~ label i,
.rating-stars-input label:hover i,
.rating-stars-input label:hover ~ label i {
    color: #ffc107;
}

/* Анимация при наведении */
.rating-stars-input label:hover {
    transform: scale(1.1);
}

/* Заливка всех звёзд до выбранной */
.rating-stars-input input:checked ~ label {
    color: #ffc107;
}

.rating-stars-input input:checked ~ label i {
    color: #ffc107;
}

/* Убедимся, что звёзды заливаются правильно */
.rating-stars-input label i.bi-star-fill {
    color: #6c757d;
}

.rating-stars-input input:checked ~ label i.bi-star-fill {
    color: #ffc107;
}

.rating-stars-input label:hover i.bi-star-fill,
.rating-stars-input label:hover ~ label i.bi-star-fill {
    color: #ffc107;
}

/* Видео */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1rem 0;
    border-radius: 0.5rem;
    background: #000;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Изображения */
.bbcode-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

/* Цитаты */
.bbcode-quote {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
}

/* Код */
.bbcode-code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.bbcode-code code {
    color: var(--text-primary);
}

/* Списки */
.bbcode-list {
    padding-left: 1.5rem;
}

.bbcode-list li {
    margin-bottom: 0.25rem;
}

.bbcode-editor {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
}

.bbcode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
}

.bbcode-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}

.bbcode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border);
}

.bbcode-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.bbcode-btn .bbcode-color span {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--glass-border);
}

.bbcode-separator {
    width: 1px;
    background: var(--glass-border);
    margin: 0 0.25rem;
}

.bbcode-textarea {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: var(--text-primary) !important;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    padding: 1rem;
}

.bbcode-textarea:focus {
    box-shadow: none !important;
}

.bbcode-help {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
}

.bbcode-help code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.bbcode-editor-split {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
}

.bbcode-editor-pane {
    flex: 1;
    min-width: 0;
    transition: width 0.3s ease;
}

.bbcode-editor-pane .bbcode-textarea {
    border-radius: 0 !important;
    min-height: 200px;
}

.bbcode-preview-pane {
    flex: 1;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: 400px;
    border-left: 1px solid var(--glass-border);
}

.bbcode-preview-content {
    color: var(--text-primary);
}

.bbcode-preview-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.pagination .page-link {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: rgba(255,255,255,0.15);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-1);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.disabled .page-link {
    background: rgba(0,0,0,0.2);
    color: var(--text-muted);
    cursor: not-allowed;
}
.badge-private {
    background: #ffc107;
    color: #2c1810;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
}

.badge-private i {
    margin-right: 0.25rem;
}

.badge-public {
    background: #17a2b8;
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
}

/* Вопрос с замком */
.question-card-private {
    border-left: 4px solid #ffc107;
}

.question-card-private:hover {
    border-left-color: var(--primary-color);
}

.question-type-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-type-card.disabled .form-check-label {
    cursor: not-allowed;
}

.question-type-card input:disabled + label {
    cursor: not-allowed;
}

.input-group-text {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 0.5rem 0 0 0.5rem;
}

.input-group .form-control {
    border-radius: 0 0.5rem 0.5rem 0;
    border-left: none;
}

.input-group .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: none;
}

/* Общие стили для заблокированных элементов */
.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    opacity: 1 !important;
    cursor: not-allowed !important;
    border-color: var(--glass-border) !important;
}

/* Для option внутри disabled select */
.form-select:disabled option {
    color: var(--text-primary) !important;
    background-color: var(--dark-bg) !important;
}

/* Стиль для заблокированного селекта с замком */
.form-select-disabled-lock {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    border-color: var(--glass-border) !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238080a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Убираем стандартную стрелку для Firefox */
.form-select-disabled-lock::-moz-focus-inner {
    border: 0;
}

/* Для input-group с заблокированным полем */
.input-group .form-control[readonly],
.input-group .form-control:disabled {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

.input-group .form-control[readonly] + .input-group-text,
.input-group .form-control:disabled + .input-group-text {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    border-color: var(--glass-border) !important;
}

/* Стили для подсказки с замком */
.form-text .bi-lock-fill {
    color: #ffc107;
}

/* Для карточек в заблокированном состоянии */
.question-type-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-type-card.disabled .form-check-label {
    cursor: not-allowed;
}

.form-select:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    opacity: 1;
    cursor: not-allowed;
}

/* Для темной темы */
.form-select:disabled option {
    color: var(--text-primary);
    background-color: var(--dark-bg);
}

/* Для input-group с disabled */
.input-group .form-control:disabled,
.input-group .form-control[readonly] {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    opacity: 1;
}

/* Альтернатива - делаем как обычный текст, но с замком */
.form-select-disabled-lock {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    border-color: var(--glass-border) !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

.form-select-disabled-lock option {
    color: var(--text-primary) !important;
    background-color: var(--dark-bg) !important;
}
