:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: #0088cc;
    /* Telegram Blue */
    --hover-bg: #1a1a1a;
    --border-color: #333333;
    --secondary-text: #888888;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --nav-bg: rgba(20, 20, 20, 0.7);
}

.top-nav {
    display: flex;
    background: var(--nav-bg);
    backdrop-filter: blur(15px);
    padding: 6px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 100;
    width: fit-content;
    margin: 0 auto 20px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-item {
    padding: 6px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--secondary-text);
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
    white-space: nowrap;
}

.nav-item.active {
    background: var(--accent-color);
    color: #fff;
}

.nav-item:not(.active):active {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(0.96);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    overscroll-behavior: none;
}

body.page-docs {
    margin: 0 auto;
    padding: 0;
    overflow-y: auto;
    height: 100%;
}

main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

header {
    margin-bottom: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
}

.site-stats {
    display: flex;
    justify-content: center;
    /* Center the stats card */
    gap: 12px;
    margin-bottom: 20px;
}

.stat-badge {
    font-size: 11px;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 4px;
}

.pulse {
    width: 6px;
    height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 0 rgba(76, 175, 80, 0.4);
    animation: pulse-animation 2s infinite;
}

.pulse.blue {
    background: #0088cc;
    animation-name: pulse-blue-animation;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

@keyframes pulse-blue-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 136, 204, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(0, 136, 204, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 136, 204, 0);
    }
}

.search-container {
    margin-bottom: 8px;
    margin: 0 15px 12px 15px;
    display: flex;
    position: relative;
    align-items: center;
}

.search-input {
    width: 100%;
    background: #111;
    border: 1px solid #222;
    padding: 10px 45px 10px 15px;
    border-radius: 25px;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s;
    font-size: 14px;
}

.search-input:focus {
    border-color: var(--accent-color);
}

.search-button {
    position: absolute;
    right: 5px;
    background: transparent;
    color: var(--secondary-text);
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    color: var(--text-color);
}

.header-filter {
    transition: 0.2s;
    border-radius: 6px;
    color: var(--secondary-text) !important;
}

.header-filter:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color) !important;
}

.header-filter.active {
    color: var(--accent-color) !important;
    font-weight: 800;
}

.bot-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    /* To show border-like separation if items touch */
}

/* Item styling - Grid Table Layout */
.bot-list-header {
    display: grid;
    grid-template-columns: 24px 1fr 60px 60px;
    align-items: center;
    padding: 10px 12px 15px 12px;
    font-size: 12px;
    color: var(--secondary-text);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.1px;
    gap: 10px;
}

.bot-item {
    display: grid;
    grid-template-columns: 24px 1fr 60px 60px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
    position: relative;
    gap: 10px;
}

.bot-item:active {
    background: rgba(255, 255, 255, 0.03);
}

.col-rank {
    font-size: 13px;
    color: var(--secondary-text);
    text-align: center;
}

.col-app, .col-users, .col-trend {
    padding: 0;
}

.col-users {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-trend {
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-text);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-app-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden; /* Prevent text from breaking layout */
    padding: 0 5px;
}

.bot-avatar.s-rounded {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.bot-avatar.s-rounded img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bot-name-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verified-badge {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.bot-desc {
    font-size: 12px;
    color: var(--secondary-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-top: 2px;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--secondary-text);
}

input,
textarea {
    width: 100%;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 12px;
    color: var(--text-color);
    outline: none;
    font-size: 16px;
    -webkit-user-select: text;
    user-select: text;
}

textarea {
    height: 100px;
    resize: none;
}

.submit-btn {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 14px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.08);
    /* More visible */
    border-radius: 25px;
    transition: all 0.3s;
    font-weight: 500;
}

.back-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

/* Add Bot Page Specifics */
.page-add-bot {
    margin-top: 0 !important;
    padding-top: 50px !important;
}

.centered-header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding-top: 10px;
}

/* Admin Actions Overlay */
.admin-actions {
    display: none;
    /* Hidden by default, triggered by long-press JS */
    position: absolute;
    bottom: 12px;
    right: 12px;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.admin-actions.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-icon {
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: var(--secondary-text);
    transition: 0.2s;
}

.admin-icon:hover {
    color: white;
    transform: scale(1.1);
}

.delete-icon:hover {
    color: #ff4444;
}

.verify-icon.active {
    color: #4CAF50;
}

/* Float button */
.add-bot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Bot Modal Bottom Sheet */
.bm-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.bm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.bm-sheet {
    position: fixed;
    bottom: -100%; left: 0; width: 100%;
    background: #111;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 15px 20px 30px 20px;
    z-index: 2001;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.bm-sheet.show {
    bottom: 0;
}
.bm-drag {
    width: 40px; height: 5px;
    background: #444;
    border-radius: 5px;
    margin: 0 auto 20px auto;
}
.bm-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 20px;
}
.bm-start-btn {
    background: var(--accent-color);
    color: white; padding: 14px; border-radius: 12px;
    font-size: 16px; font-weight: 600; text-align: center; text-decoration: none;
    transition: 0.2s;
}
.bm-start-btn:active { transform: scale(0.98); background: #0077b3; }

.like-heart {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-heart.active {
    transform: scale(1.2);
    animation: heartPop 0.3s ease-out;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1.2); }
}