:root {
    --bg-dark: #121417;
    --sidebar-bg: #161a1e;
    --accent: #00ced1;
    --text-main: #ffffff;
    --text-dim: #9ba3af;
    --card-bg: #1e2329;
    --discord-btn: #5865F2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: #121417; /* Колір-запас */
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    display: flex;
    min-height: 100vh;
    color: var(--text-main);
    
    /* Оновлений градієнт: зробив сітку трохи помітнішою */
    background: 
        radial-gradient(circle at center, rgba(30, 35, 41, 0.7) 0%, rgba(18, 20, 23, 1) 100%),
        repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(255, 255, 255, 0.03) 1px, rgba(255, 255, 255, 0.03) 2px),
        repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255, 255, 255, 0.03) 1px, rgba(255, 255, 255, 0.03) 2px),
        #121417;
    background-size: 100% 100%, 30px 30px, 30px 30px; /* Розмір сітки 30 пікселів */
    background-attachment: fixed;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid #2d3136;
    padding: 25px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
}

.sidebar-brand {
    padding: 0 25px 30px;
    font-size: 22px;
    font-weight: 800;
}

.sidebar-brand span { color: var(--accent); }

.brand-sub {
    font-size: 24px;
    margin-top: 20px;
}

.menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 12px 25px;
    color: var(--text-dim);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    transition: 0.2s;
}

.menu-item i { width: 20px; text-align: center; }

.menu-item:hover {
    background: #20252b;
    color: #fff;
}

.menu-item.active {
    color: var(--accent);
    background: rgba(0, 206, 209, 0.05);
    border-right: 3px solid var(--accent);
}

.badge {
    background: #2d3136;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
}

.menu-divider {
    height: 1px;
    background: #2d3136;
    margin: 20px 25px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 20px 60px;
}

.top-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 60px;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.top-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
}

.user-pill {
    background: var(--accent);
    color: #000;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hero Section */
.hero {
    max-width: 800px;
}

.hero-title {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 5px;
}

.hero-subtitle {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 25px;
}

/* Контейнер пошуку клану (копія стилю гравців) */
.clan-search-container {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: #16191c;
    border: 1px solid #24282c;
    border-radius: 8px;
    padding: 0 15px;
    transition: border-color 0.2s;
    max-width: 600px; /* Обмежуємо ширину для краси */
    margin: 0 auto;   /* Центруємо */
}

.clan-search-container:focus-within {
    border-color: var(--accent);
}

#clan-tag-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: white !important;
    padding: 15px 10px;
    font-size: 16px;
    outline: none !important;
}

#clan-tag-input::placeholder {
    color: var(--text-dim);
    font-style: italic;
    opacity: 0.7;
}

.hero-desc {
    color: var(--text-dim);
    font-size: 18px;
    margin-bottom: 40px;
}

.stats-counter {
    display: flex;
    gap: 50px;
    margin-bottom: 40px;
}

.stat-num {
    display: block;
    font-size: 32px;
    font-weight: 800;
}

.stat-label {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
}

/* Search Bar */
.search-area {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.search-wrapper {
    flex: 1;
    background: #1e2329;
    border: 1px solid #383e45;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.search-wrapper i { color: #5e6673; }

.search-wrapper input {
    background: transparent;
    border: none;
    color: white;
    padding: 15px;
    width: 100%;
    outline: none;
    font-size: 16px;
}

.btn-search {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 0 35px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    font-size: 16px;
}

.btn-discord-large {
    background: var(--discord-btn);
    color: white;
    border: none;
    padding: 16px 30px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

/* Фіксуємо контейнер, щоб він не стискався */
#dynamic-content {
    min-height: 600px; 
    display: flex;
    flex-direction: column;
}

/* Однаковий відступ для всіх сторінок */
.hero {
    padding-top: 40px;
    animation: fadeIn 0.3s ease; /* Додамо плавний перехід */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Щоб заголовки не штовхали контент вниз, якщо вони порожні */
.hero-title {
    min-height: 70px;
    margin: 0;
}
.clans-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.clans-table th {
    background: #252a30;
    color: var(--text-dim);
    text-align: left;
    padding: 15px;
    font-size: 13px;
    text-transform: uppercase;
}

.clans-table td {
    padding: 15px;
    border-bottom: 1px solid #2d3136;
    font-size: 14px;
}

.clan-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.wn8-purple { color: #a020f0; font-weight: bold; }
.rating-high { color: var(--accent); }

.clans-table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1d21;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
}

.clans-table th, .clans-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #2d3136;
}

.clans-table th {
    background: #15181c;
    color: #889097;
    font-size: 12px;
    text-transform: uppercase;
}

.wn8-yellow { color: #d4d422; font-weight: bold; }
.win-green { color: #4caf50; font-weight: bold; }
.badge {
    background: #383e45;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 10px;
}

/* Стиль для тексту всередині поля, поки користувач нічого не ввів */
#player-search-input::placeholder {
    color: var(--text-dim); /* Використовуємо твою змінну кольору */
    font-style: italic;     /* Робимо текст курсивом */
    opacity: 0.7;           /* Трохи приглушуємо колір */
}

/* Контейнер, який створює темну "обгортку" */
.search-container {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: #16191c; /* Темний колір фону */
    border: 1px solid #24282c; /* Тонка межа */
    border-radius: 8px;        /* Округлені кути */
    padding: 0 15px;           /* Відступи всередині */
    transition: border-color 0.2s; /* Плавна анімація при натисканні */
}

/* Підсвітка, коли ти клікаєш у поле пошуку */
.search-container:focus-within {
    border-color: var(--accent); /* Колір стає бірюзовим */
}

/* САМЕ ПОЛЕ ВВОДУ (прибираємо стандартний білий фон) */
#player-search-input {
    flex: 1;
    background: transparent !important; /* Робимо прозорим, щоб бачити фон контейнера */
    border: none !important;            /* Прибираємо стандартну рамку браузера */
    color: white !important;            /* Колір тексту, який ти пишеш */
    padding: 15px 10px;
    font-size: 16px;
    outline: none !important;           /* Прибираємо синю обводку Chrome */
}

/* Стиль іконки лупи */
.search-container i {
    color: #5e6673;
    font-size: 18px;
}

/* Нові стилі для дашборду гравця */
.player-dashboard {
    animation: fadeIn 0.4s ease-out;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--sidebar-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #2d3136;
    margin-bottom: 30px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}


.user-nickname {
    font-size: 32px;
    font-weight: 800;
}

.main-rating-badge {
    padding: 15px 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 160px;
}

.rating-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.rating-value {
    font-size: 38px;
    font-weight: 900;
}

/* Оновлені картки */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #2d3136;
    position: relative;
    overflow: hidden;
}

.card-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 55px;
    opacity: 0.08;
    transform: rotate(-15deg);
}

.stat-card .stat-label {
    display: block;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Вимикаємо білий фон Chrome при автозаповненні */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus {
    -webkit-text-fill-color: white !important;
    -webkit-box-shadow: 0 0 0px 1000px #16191c inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Стиль для самої пігулки */
.user-pill {
    background-color: var(--accent); /* Твій бірюзовий колір */
    padding: 6px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    transition: 0.2s;
}

/* Робимо текст, іконки та посилання всередині ЧОРНИМИ */
.user-pill, 
.user-pill span, 
.user-pill i, 
.user-pill a {
    color: #000000 !important;
    text-decoration: none;
}

.user-pill:hover {
    filter: brightness(0.9);
}
.clan-header {
    text-align: center;
    margin-bottom: 30px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #2d3136;
}

.clan-header h1 {
    font-size: 36px;
    margin: 15px 0;
    color: var(--accent);
}

.clan-header p {
    font-style: italic;
    color: var(--text-dim);
}
.clan-hero-card {
    display: flex;
    align-items: center;
    gap: 30px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #2d3136;
    margin-bottom: 25px;
}

.clan-big-emblem { width: 120px; height: 120px; }

.clan-title { font-size: 32px; font-weight: 850; color: var(--accent); }

.clan-motto { font-style: italic; color: var(--text-dim); margin: 10px 0; }

.clan-meta { display: flex; gap: 20px; font-size: 14px; color: var(--text-dim); }

.role-cell.commander { color: #ff4d4d; font-weight: bold; }
.role-cell.executive_officer { color: #ffaa00; }
.role-cell.private { color: var(--text-main); }

.clans-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.btn-minus {
    background: #333;
    border: 1px solid #444;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: bold;
}

.btn-minus:hover {
    background: #bc2026;
    border-color: #ff4d4d;
}

.btn-minus:active {
    transform: scale(0.95);
}

/* Контейнер для двох колонок */
.clan-main-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
}

/* Ліва частина з таблицею */
.clan-left-col {
    flex: 2; /* Займає 2/3 ширини */
    min-width: 0;
}

/* Права частина з калькулятором */
.clan-right-col {
    flex: 1; /* Займає 1/3 ширини */
    position: sticky;
    top: 20px; /* Прилипає до верху при скролі */
    min-width: 300px;
}

/* Стилі для кнопок мінуса */
.btn-minus {
    transition: all 0.2s;
}

.btn-minus:hover {
    background: #333 !important;
    border-color: var(--accent) !important;
}

.btn-minus:active {
    transform: scale(0.95);
}


/* Головний контейнер */
.clan-layout-container {
    display: flex;
    flex-direction: row; /* Тільки в рядок */
    gap: 25px;
    align-items: flex-start; /* Важливо для sticky */
    width: 100%;
    position: relative;
}

/* Ліва частина */
.clan-main-content {
    flex: 1; /* Займає весь вільний простір */
    min-width: 0;
}

/* Права частина (Сайдбар) */
.clan-sidebar {
    width: 320px; /* Фіксована ширина калькулятора */
    position: sticky;
    top: 20px; /* Відступ від верху екрана при скролі */
    z-index: 10;
}

/* Оформлення калькулятора */
.calc-box {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.calc-screen {
    background: #000;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    border: 1px solid #222;
}

.calc-val {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #4caf50;
}

.calc-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.btn-minus {
    background: #252525;
    border: 1px solid #444;
    color: white;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-minus:hover {
    border-color: var(--accent);
    background: #333;
}

.btn-reset {
    width: 100%;
    background: #bc2026;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999; /* Максимальний пріоритет */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1a1a1a;
    color: white;
    padding: 14px 24px;
    border-radius: 6px;
    font-size: 14px;
    border-left: 4px solid #4caf50;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}
