/* ============================================ */
/*                ПЕРЕМЕННЫЕ                    */
/* ============================================ */

:root {
    /* Основные цвета Discord */
    --blurple: #5865F2;
    --blurple-hover: #4752C4;
    --green: #23A55A;
    --green-hover: #1E8749;
    --yellow: #FAA61A;
    --red: #ED4245;
    --red-hover: #C03537;
    /* Фоны */
    --bg-primary: #36393F;
    --bg-secondary: #2F3136;
    --bg-tertiary: #202225;
    --bg-card: #292B2F;
    /* Текст */
    --text-primary: #FFFFFF;
    --text-secondary: #B9BBBE;
    --text-muted: #96989D;
    /* Границы и тени */
    --border-color: #202225;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.3);
    /* Скругления */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    /* Анимации */
    --transition: all 0.2s ease-in-out;
    
    /* 🌙 ТЁМНАЯ ТЕМА (по умолчанию) */
    --theme-body-bg: radial-gradient(ellipse at bottom, #0a0f1a 0%, #05070a 100%);
    --theme-navbar-bg: rgba(32, 34, 37, 0.7);
    --theme-card-bg: rgba(41, 43, 47, 0.7);
    --theme-card-hover: rgba(41, 43, 47, 0.9);
    --theme-input-bg: rgba(0, 0, 0, 0.3);
    --theme-input-border: rgba(255, 255, 255, 0.1);
    --theme-table-hover: rgba(88, 101, 242, 0.08);
    --theme-blocked-bg: rgba(255, 255, 255, 0.05);
    --theme-settings-card-bg: rgba(18, 22, 28, 0.6);
    --theme-navbar-sticky: rgba(18, 22, 28, 0.9);
    --theme-save-bar: rgba(18, 22, 28, 0.6);
}

/* ☀️ СВЕТЛАЯ ТЕМА */
[data-theme="light"] {
    --bg-primary: #E3E5E8;
    --bg-secondary: #F2F3F5;
    --bg-tertiary: #EBEDEF;
    --bg-card: #FFFFFF;
    --text-primary: #313338;
    --text-secondary: #4E5058;
    --text-muted: #80848E;
    --border-color: #D7D8DB;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    
    --theme-body-bg: linear-gradient(135deg, #f0f2f5 0%, #e8ebf0 100%);
    --theme-navbar-bg: rgba(255, 255, 255, 0.85);
    --theme-card-bg: rgba(255, 255, 255, 0.9);
    --theme-card-hover: rgba(255, 255, 255, 1);
    --theme-input-bg: #FFFFFF;
    --theme-input-border: rgba(0, 0, 0, 0.15);
    --theme-table-hover: rgba(88, 101, 242, 0.05);
    --theme-blocked-bg: rgba(255, 255, 255, 0.8);
    --theme-settings-card-bg: rgba(255, 255, 255, 0.85);
    --theme-navbar-sticky: rgba(255, 255, 255, 0.9);
    --theme-save-bar: rgba(255, 255, 255, 0.85);
}

/* ============================================ */
/*                  СБРОС СТИЛЕЙ                */
/* ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--theme-body-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

@supports (font-family: 'Whitney') {
    body {
        font-family: 'Whitney', sans-serif;
    }
}

/* ============================================ */
/*              ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ              */
/* ============================================ */

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.03);
}

.theme-toggle-btn .icon {
    font-size: 18px;
    line-height: 1;
}

[data-theme="light"] .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================ */
/*         🌌 КОСМИЧЕСКИЙ ФОН (только тёмная)   */
/* ============================================ */

.cosmic-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-1, .glow-2, .glow-3 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    will-change: transform;
}

.glow-1 {
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle at 30% 30%, #6a00ff, #1b0033 70%);
    top: -20%;
    left: -10%;
}

.glow-2 {
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle at 70% 70%, #00d4ff, #001a33 70%);
    bottom: -10%;
    right: -10%;
}

.glow-3 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle at 50% 50%, #ff00cc, #330022 70%);
    top: 30%;
    left: 30%;
}

/* В светлой теме скрываем космические эффекты */
[data-theme="light"] .cosmic-glow { display: none; }
[data-theme="light"] canvas.site-animated-bg { display: none; }
[data-theme="light"] .stars-container { display: none; }

/* ============================================ */
/*                 ТИПОГРАФИКА                  */
/* ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

h1 { font-size: 32px; letter-spacing: -0.5px; }
h2 { font-size: 24px; letter-spacing: -0.3px; }
h3 { font-size: 20px; }

p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

a {
    color: var(--blurple);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--blurple-hover);
    text-decoration: underline;
}

/* ============================================ */
/*                  КНОПКИ                      */
/* ============================================ */

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blurple), #3D4CBE);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6b7aff, #4a5ad4);
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.5);
    transform: translateY(-2px) scale(1.02);
    text-decoration: none;
    color: white;
}

.btn-success {
    background-color: var(--green);
    color: white;
}

.btn-success:hover {
    background-color: var(--green-hover);
    text-decoration: none;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-danger {
    background-color: var(--red);
    color: white;
}

.btn-danger:hover {
    background-color: var(--red-hover);
    text-decoration: none;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    text-decoration: none;
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--bg-secondary);
    text-decoration: none;
    color: var(--text-primary);
}

/* ============================================ */
/*                  КАРТОЧКИ                    */
/* ============================================ */

.card {
    background-color: var(--theme-card-bg) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

[data-theme="light"] .card {
    border-color: rgba(0, 0, 0, 0.08);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.card-content {
    color: var(--text-secondary);
}

/* ============================================ */
/*                  СЕТКА                       */
/* ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col { flex: 1; padding: 0 12px; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding: 0 12px; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; padding: 0 12px; }
.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 12px; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; padding: 0 12px; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 12px; }

/* ============================================ */
/*                  НАВИГАЦИЯ                   */
/* ============================================ */

.navbar {
    background-color: var(--theme-navbar-bg) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
}

[data-theme="light"] .navbar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.navbar-brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-brand:hover {
    text-decoration: none;
    color: var(--text-primary);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
}

.nav-item a {
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-item a:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    text-decoration: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover { opacity: 0.8; }

/* ============================================ */
/*             СЕРВЕРЫ (ГРИД КАРТОЧЕК)          */
/* ============================================ */

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.server-card {
    background-color: rgba(41, 43, 47, 0.8) !important;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.server-card:hover {
    border-color: var(--blurple);
    box-shadow: 0 0 30px rgba(88, 101, 242, 0.3);
    transform: translateY(-4px);
}

.server-icon {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: var(--bg-tertiary);
}

.server-icon-placeholder {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blurple), #3D4CBE);
    color: white;
    font-size: 48px;
    font-weight: 700;
}

.server-info { padding: 20px; }

.server-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.server-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================ */
/*               ПЕРЕКЛЮЧАТЕЛИ (TOGGLE)         */
/* ============================================ */

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    transition: var(--transition);
}

[data-theme="light"] .toggle-slider {
    background-color: rgba(0, 0, 0, 0.15);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--green);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================ */
/*                  ФОРМЫ                       */
/* ============================================ */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--theme-input-bg);
    border: 1px solid var(--theme-input-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: border 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--blurple);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control { cursor: pointer; }

/* ============================================ */
/*               ТАБЛИЦЫ                        */
/* ============================================ */

.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:hover { background-color: var(--theme-table-hover); }

/* ============================================ */
/*               АЛЕРТЫ / УВЕДОМЛЕНИЯ           */
/* ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.alert-success {
    background-color: rgba(35, 165, 90, 0.1);
    border: 1px solid var(--green);
}

.alert-error {
    background-color: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--red);
}

.alert-warning {
    background-color: rgba(250, 166, 26, 0.1);
    border: 1px solid var(--yellow);
}

.alert-info {
    background-color: rgba(88, 101, 242, 0.1);
    border: 1px solid var(--blurple);
}

/* ============================================ */
/*               УТИЛИТЫ                        */
/* ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.p-5 { padding: 32px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; }

/* ============================================ */
/*               АДАПТИВНОСТЬ                   */
/* ============================================ */

@media (max-width: 768px) {
    .container { padding: 0 16px; }
    h1 { font-size: 28px; }
    .navbar { flex-direction: column; gap: 16px; }
    .navbar-nav { flex-wrap: wrap; justify-content: center; }
    .servers-grid { grid-template-columns: 1fr; }
    .col-3, .col-4, .col-6, .col-8 { flex: 0 0 100%; max-width: 100%; }
    .table { font-size: 14px; }
    .table th, .table td { padding: 8px 12px; }
}

@media (max-width: 480px) {
    h1 { font-size: 24px; }
    .btn { padding: 10px 20px; font-size: 14px; }
    .card { padding: 16px; }
}

/* ============================================ */
/*               АНИМАЦИИ                       */
/* ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease-in-out; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading { animation: pulse 1.5s ease-in-out infinite; }

/* ============================================ */
/*               ПРОКРУТКА                      */
/* ============================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--bg-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-secondary); }

/* ============================================ */
/*         🌠 ПАДАЮЩИЕ ЗВЁЗДЫ (только тёмная)   */
/* ============================================ */

.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.7;
    filter: blur(1px);
    animation: fall linear infinite;
    pointer-events: none;
}

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}