/*
=================================================================
USERBOT CONTROL PANEL - CYBERPUNK NEON THEME
=================================================================
1. :root Variables      - Color Palette, Gradients, Shadows
2. Global Styles        - Body, Typography, Scrollbar
3. Layout & Containers  - Containers, General Layout
4. Core Components      - Cards, Buttons, Forms, Alerts, Modals
5. Page-Specific Styles - Dashboard, Login, Statistics, etc.
6. Animations & FX      - Transitions, Keyframes, Special Effects
=================================================================
*/


/* 1. :root Variables */

:root {
    --bg-color-dark: #0A0C10;
    /* Deep space blue/black */
    --bg-color-medium: #151922;
    /* Slightly lighter for surfaces */
    --bg-color-light: #1F2430;
    /* For hovered elements */
    --primary-neon: #00BFFF;
    /* DeepSkyBlue */
    --secondary-neon: #9400D3;
    /* DarkViolet */
    --accent-neon: #32CD32;
    /* LimeGreen */
    --danger-neon: #FF4500;
    /* OrangeRed */
    --text-color-primary: #E6F1FF;
    /* Light, almost white blue */
    --text-color-secondary: #A8B2C1;
    /* Muted gray for hints */
    --text-color-disabled: #6A7382;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Menlo', monospace;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-color: rgba(0, 191, 255, 0.2);
    /* Neon blue border */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-neon-primary: 0 0 12px rgba(0, 191, 255, 0.5), 0 0 24px rgba(0, 191, 255, 0.3);
    --shadow-neon-accent: 0 0 10px rgba(50, 205, 50, 0.6);
    --transition-fast: 0.2s ease-in-out;
    --transition-medium: 0.4s ease-in-out;
}


/* 2. Global Styles */

body {
    background-color: var(--bg-color-dark);
    background-image: /* Grid pattern */
    linear-gradient(rgba(0, 191, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 191, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    color: var(--text-color-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global Loader ----------------------------------------------------------- */
.loader-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 2000;
    pointer-events: none;
    transition: opacity var(--transition-medium), visibility var(--transition-medium);
}

.loader {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.loader-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-neon);
    box-shadow: 0 0 12px rgba(0, 191, 255, 0.6);
    animation: loaderPulse 1s infinite ease-in-out;
}

.loader-dot:nth-child(2) { animation-delay: 0.15s; }
.loader-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderPulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.loader-logo {
    font-size: 2rem;
    color: var(--primary-neon);
    text-shadow: 0 0 18px rgba(0, 191, 255, 0.7);
}

.loading-screen {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.welcome-screen.loading-screen {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}


/* Custom Scrollbar */

::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: var(--primary-neon);
    border-radius: 10px;
    border: 2px solid var(--bg-color-dark);
}

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4 {
    font-weight: 700;
    color: var(--text-color-primary);
    text-shadow: 0 0 5px rgba(230, 241, 255, 0.2);
    letter-spacing: -0.5px;
}
.page-header {
    gap: .75rem;
}

.page-header-title {
    font-size: clamp(1.05rem, 0.9rem + 1.4vw, 1.5rem);
    margin: 0;
}

.page-header .bi {
    font-size: 1.1em;
}

.btn.btn-fluid {
    font-size: clamp(0.72rem, 0.6rem + 0.9vw, 0.9rem);
    padding: .45rem .8rem;
    line-height: 1.1;
    text-transform: none; /* уменьшает ширину текста на маленьких экранах */
    letter-spacing: 0;     /* убираем растяжение букв */
    white-space: nowrap;
    max-width: 46vw;       /* не даём кнопке съедать заголовок */
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 360px) {
    .page-header-title { font-size: clamp(0.9rem, 0.8rem + 1vw, 1.1rem); }
    .btn.btn-fluid { font-size: clamp(0.66rem, 0.58rem + 0.7vw, 0.82rem); padding: .38rem .65rem; max-width: 52vw; }
}

a {
    color: var(--primary-neon) !important;
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    filter: brightness(1.2);
    text-shadow: 0 0 8px var(--primary-neon);
}


/* 3. Layout & Containers */


/* User Management: агрессивная мобильная типографика и сжатие компоновки */
.user-mgmt-page {
    font-size: clamp(12px, 1vw + 0.2rem, 15px);
}

.user-mgmt-page .card-title,
.user-mgmt-page h5,
.user-mgmt-page h6 {
    font-size: clamp(0.95rem, 0.75rem + 1vw, 1.1rem);
}

.user-mgmt-page .form-label,
.user-mgmt-page .form-control,
.user-mgmt-page .form-select,
.user-mgmt-page .input-group-text {
    font-size: clamp(0.78rem, 0.65rem + 0.6vw, 0.95rem);
}

.user-mgmt-page .btn,
.user-mgmt-page .btn .btn-text {
    font-size: clamp(0.8rem, 0.65rem + 0.8vw, 0.95rem);
    letter-spacing: 0;
    text-transform: none;
}

.user-mgmt-page .btn {
    padding: .5rem .85rem;
}

.user-mgmt-page .card-header { padding: .6rem .85rem; }
.user-mgmt-page .card-body { padding: .85rem; }

/* Гриды и таблицы в результатах поиска: перенос/резка текста */
.user-mgmt-page #users-list,
.user-mgmt-page table {
    font-size: clamp(0.78rem, 0.6rem + 0.6vw, 0.95rem);
}

.user-mgmt-page table th,
.user-mgmt-page table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}

.user-mgmt-page .stat-card span { font-size: clamp(0.95rem, 0.8rem + 1.2vw, 1.2rem); }
.user-mgmt-page .stat-card h6 { font-size: clamp(0.75rem, 0.6rem + 0.7vw, 0.95rem); }

/* Кнопки действий в карточках */
.user-mgmt-page .user-actions .btn,
.user-mgmt-page .app-actions .btn {
    padding: .42rem .7rem;
    font-size: clamp(0.78rem, 0.6rem + 0.7vw, 0.9rem);
}

.user-mgmt-page .user-actions.grid-2x2 .btn,
.user-mgmt-page .application-card .app-actions.grid-2x2 .btn {
    width: 100%;
}

@media (max-width: 420px) {
    .user-mgmt-page .row.g-3 { row-gap: .5rem; }
    .user-mgmt-page .col-md-3, 
    .user-mgmt-page .col-md-2 { flex: 0 0 50%; max-width: 50%; }
    .user-mgmt-page .col-md-6 { flex: 0 0 100%; max-width: 100%; }
    .user-mgmt-page .card-header { padding: .5rem .75rem; }
    .user-mgmt-page .card-body { padding: .75rem; }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}


/* 4. Core Components */


/* --- Cards (Glassmorphism) --- */

.card {
    background: rgba(21, 25, 34, 0.6);
    /* Semi-transparent dark bg */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-medium);
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 191, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.2), var(--shadow-lg);
}


/* Disable glass hover effects for cards that must stay static */

.card.no-hover,
.card.no-hover:hover {
    transform: none !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
}

.card-header {
    background: rgba(0, 191, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-weight: 600;
}

.card-title {
    color: var(--text-color-primary) !important;
}

.card-body {
    padding: 1rem;
}


/* --- Buttons --- */

.btn {
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    padding: 10px 24px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
}
.btn-sm,
.btn-xs {
    text-transform: none;
    letter-spacing: 0;
}

.btn-xs {
    padding: .25rem .5rem !important;
    font-size: .75rem !important;
    line-height: 1.1 !important;
}

@media (max-width: 420px) {
    .btn, .btn .btn-text { font-size: clamp(0.76rem, 0.7rem + 0.6vw, 0.88rem); }
    .btn-sm { font-size: .78rem; }
    .btn-xs { font-size: .7rem !important; padding: .3rem .55rem !important; }
}

.btn-primary {
    background-color: var(--primary-neon);
    color: var(--bg-color-dark) !important;
    border-color: var(--primary-neon);
    box-shadow: var(--shadow-neon-primary);
}

.btn-primary:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-neon) !important;
    border-color: var(--primary-neon);
}

.btn-secondary:hover {
    background-color: rgba(0, 191, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger-neon) !important;
    border-color: var(--danger-neon);
}

.btn-danger:hover {
    background-color: rgba(255, 69, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 69, 0, 0.4);
}


/* --- Forms --- */

.form-control,
.form-select {
    background-color: var(--bg-color-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-color-primary) !important;
    padding: 12px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-color-medium);
    border-color: var(--primary-neon);
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.25);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-color-disabled) !important;
}

.form-label {
    font-weight: 500;
    color: var(--text-color-secondary) !important;
}


/* --- Alerts --- */

.alert {
    border-radius: var(--border-radius-md);
    border-width: 1px;
    border-style: solid;
    padding: 1rem;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(50, 205, 50, 0.1);
    border-color: var(--accent-neon);
    color: var(--accent-neon) !important;
    text-shadow: 0 0 5px var(--accent-neon);
}

.alert-danger {
    background-color: rgba(255, 69, 0, 0.1);
    border-color: var(--danger-neon);
    color: var(--danger-neon) !important;
    text-shadow: 0 0 5px var(--danger-neon);
}

.alert-info {
    background-color: rgba(0, 191, 255, 0.1);
    border-color: var(--primary-neon);
    color: var(--primary-neon) !important;
    text-shadow: 0 0 5px var(--primary-neon);
}


/* Modals are no longer used: modal-specific styles removed */

.btn-close {
    filter: invert(1) grayscale(1) brightness(2);
    transition: transform var(--transition-fast);
}

.btn-close:hover {
    transform: rotate(90deg);
}


/* --- Tables --- */

.table {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
    color: var(--text-color-secondary);
}

.table th {
    color: var(--text-color-primary);
    font-weight: 600;
}

.table-hover>tbody>tr:hover>* {
    --bs-table-hover-bg: rgba(0, 191, 255, 0.08);
    color: var(--text-color-primary);
}


/* 5. Page-Specific Styles */
/* --- Statistics Page --- */
.statistics-page {
    font-size: clamp(12px, 1vw + 0.2rem, 16px);
}

.statistics-page .card { padding: 0; }
.statistics-page .card-header { padding: .75rem 1rem; }
.statistics-page .card-body { padding: 1rem; }

.statistics-page .profile-img {
    width: clamp(88px, 18vw, 140px) !important;
    height: clamp(88px, 18vw, 140px) !important;
}

.statistics-page .username { font-size: clamp(1rem, 0.8rem + 1.2vw, 1.5rem); }
.statistics-page .user-id { font-size: clamp(0.85rem, 0.7rem + 0.8vw, 1rem) !important; }

.statistics-page .badge { font-size: clamp(0.7rem, 0.6rem + 0.5vw, 0.9rem); }

.statistics-page .data-item span { font-size: clamp(0.8rem, 0.65rem + 0.6vw, 0.95rem); }
.statistics-page .data-item p.fs-5 { font-size: clamp(0.95rem, 0.8rem + 1vw, 1.25rem) !important; }

.statistics-page .rating-value { font-size: clamp(0.95rem, 0.8rem + 1vw, 1.25rem); }
.statistics-page .rating-bar-container { width: 100%; height: 8px; }
.statistics-page .rating-bar { height: 8px; }

.statistics-page .fk-value { font-size: clamp(0.95rem, 0.8rem + 1vw, 1.25rem); }
.statistics-page .fk-stars .bi { font-size: clamp(0.9rem, 0.7rem + 0.8vw, 1.1rem); }

.statistics-page .leave-type-chip,
.statistics-page .leave-status-badge { font-size: clamp(0.7rem, 0.6rem + 0.6vw, 0.95rem); }
.statistics-page .countdown-timer { font-size: clamp(0.9rem, 0.75rem + 0.9vw, 1.1rem); }

.statistics-page .leave-time-card .card-title { font-size: clamp(0.9rem, 0.75rem + 0.9vw, 1.1rem); }
.statistics-page .leave-date, .statistics-page .leave-time { font-size: clamp(0.95rem, 0.8rem + 1vw, 1.2rem); }

.statistics-page .status-badge { font-size: clamp(0.75rem, 0.6rem + 0.7vw, 1rem); }

@media (max-width: 420px) {
    .statistics-page .card-header { padding: .6rem .8rem; }
    .statistics-page .card-body { padding: .85rem; }
}

/* Выравнивание «плашек» типов/статусов увольнений */
.leave-type-chip,
.leave-status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .5rem;
    border-radius: .5rem;
    line-height: 1;
}

.leave-chip-vechernee { background: rgba(255, 0, 0, 0.08); }
.leave-chip-dnevnoe { background: rgba(255, 200, 0, 0.1); }
.leave-chip-sutochnoe { background: rgba(0, 180, 255, 0.12); }

/* Desktop XL: не ужимать слишком сильно на больших экранах */
@media (min-width: 1440px) {
    .statistics-page { font-size: 17px; }
    .statistics-page .username { font-size: 1.9rem; }
    .statistics-page .user-id { font-size: 1.12rem !important; }
    .statistics-page .badge { font-size: 1rem; }
    .statistics-page .data-item p.fs-5 { font-size: 1.45rem !important; }
    .statistics-page .rating-value, .statistics-page .fk-value { font-size: 1.45rem; }
    .statistics-page .fk-stars .bi { font-size: 1.2rem; }
    .statistics-page .leave-type-chip, .statistics-page .leave-status-badge { font-size: 1rem; }
    .statistics-page .countdown-timer { font-size: 1.2rem; }
    .statistics-page .leave-time-card .card-title { font-size: 1.2rem; }
    .statistics-page .leave-date, .statistics-page .leave-time { font-size: 1.32rem; }
}

@media (min-width: 1920px) {
    .statistics-page { font-size: 18px; }
    .statistics-page .username { font-size: 2rem; }
    .statistics-page .user-id { font-size: 1.2rem !important; }
    .statistics-page .badge { font-size: 1.05rem; }
    .statistics-page .data-item p.fs-5 { font-size: 1.55rem !important; }
    .statistics-page .rating-value, .statistics-page .fk-value { font-size: 1.55rem; }
    .statistics-page .fk-stars .bi { font-size: 1.25rem; }
    .statistics-page .leave-type-chip, .statistics-page .leave-status-badge { font-size: 1.05rem; }
    .statistics-page .countdown-timer { font-size: 1.28rem; }
    .statistics-page .leave-time-card .card-title { font-size: 1.28rem; }
    .statistics-page .leave-date, .statistics-page .leave-time { font-size: 1.4rem; }
}


/* --- Login / Index Page --- */

.hero-section {
    position: relative;
    padding: 4rem 0;
}

.hero-logo .logo-icon {
    font-size: 4rem;
    color: var(--primary-neon);
    text-shadow: 0 0 20px var(--primary-neon);
}

.text-gradient {
    background: linear-gradient(90deg, var(--text-color-primary), var(--primary-neon));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* --- Dashboard --- */

.dashboard-page .card-link {
    display: block;
    height: 100%;
}

.dashboard-page .card-link .card {
    height: 100%;
}

.dashboard-page .card-link .card i {
    font-size: 2.5rem;
    color: var(--primary-neon) !important;
    transition: all var(--transition-medium);
}

.dashboard-page .card-link:hover .card i {
    transform: scale(1.2);
    filter: brightness(1.3);
    text-shadow: 0 0 15px var(--primary-neon);
}

.dashboard-page .welcome-card .avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--bg-color-dark) !important;
}


/* 6. Animations & FX */


/* --- General Transition for all elements --- */

* {
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}


/* Жесткие ограничения внутри Telegram WebApp: никаких transform на hover */

body.tg-webapp .card,
body.tg-webapp .card * {
    transform: none !important;
}

body.tg-webapp .card:hover {
    transform: none !important;
}

body.tg-webapp .card.no-hover,
body.tg-webapp .card.no-hover:hover {
    transform: none !important;
}


/* --- Keyframe Animations --- */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 191, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 191, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 191, 255, 0);
    }
}

.pulse-fx {
    animation: pulse 2s infinite;
}


/* --- Utility Classes --- */

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

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

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


/* Force important colors, overriding bootstrap defaults */

.text-dark,
.text-black,
.text-muted,
p,
label {
    color: var(--text-color-secondary) !important;
}

.bg-dark *,
.bg-black *,
.bg-primary *,
.bg-success *,
.bg-danger *,
.bg-warning *,
.bg-info * {
    color: var(--text-color-primary) !important;
}

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

.badge.bg-light {
    color: var(--bg-color-dark) !important;
}


/* Final overrides to ensure text is visible */

body,
div,
span,
h1,
h2,
h3,
h4,
h5,
h6,
.form-label,
.form-text,
.card-text,
th,
td {
    color: var(--text-color-primary) !important;
}

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

.bi {
    color: inherit !important;
}

.form-control::placeholder {
    color: var(--text-color-disabled) !important;
}