/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-hover: #1e1e1e;
    --bg-input: #0d0d0d;
    --border-color: #2a2a2a;
    --border-light: #333333;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --accent-glow: rgba(231, 76, 60, 0.15);
    --success: #27ae60;
    --warning: #f39c12;
    --info: #3498db;
    --xp-gradient: linear-gradient(90deg, #e74c3c, #f39c12);
    --sidebar-width: 280px;
    --bottom-bar-height: 48px;
    --radius: 8px;
    --radius-sm: 6px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: transparent;
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* ===== ANIMATED MONOCHROME BACKGROUND ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.006) 2px,
            rgba(255, 255, 255, 0.006) 4px
        ),
        radial-gradient(ellipse 100% 60% at 50% -10%, rgba(255, 255, 255, 0.05), transparent 70%),
        radial-gradient(ellipse 80% 50% at 80% 110%, rgba(255, 255, 255, 0.03), transparent 60%),
        radial-gradient(ellipse 60% 40% at 10% 50%, rgba(255, 255, 255, 0.025), transparent 50%),
        linear-gradient(180deg, #000000 0%, #0a0a0a 30%, #050505 60%, #0a0a0a 100%);
    background-blend-mode: overlay, normal, normal, normal, normal;
    z-index: -2;
    animation: bgBreath 25s ease-in-out infinite;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.18) 0.5px, transparent 0.5px),
        radial-gradient(circle at 35% 75%, rgba(255, 255, 255, 0.12) 0.5px, transparent 0.5px),
        radial-gradient(circle at 65% 15%, rgba(255, 255, 255, 0.15) 0.5px, transparent 0.5px),
        radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.1) 0.5px, transparent 0.5px),
        radial-gradient(circle at 25% 60%, rgba(255, 255, 255, 0.08) 0.5px, transparent 0.5px),
        radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.11) 0.5px, transparent 0.5px),
        radial-gradient(circle at 75% 35%, rgba(255, 255, 255, 0.09) 0.5px, transparent 0.5px),
        radial-gradient(circle at 40% 90%, rgba(255, 255, 255, 0.06) 0.5px, transparent 0.5px);
    background-size: 500px 500px;
    z-index: -1;
    animation: starsDrift 80s linear infinite, starTwinkle 4s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes bgBreath {
    0%, 100% { 
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    25% { 
        transform: scale(1.02) translate(-1%, 1%);
        opacity: 0.95;
    }
    50% { 
        transform: scale(1.01) translate(0.5%, -0.5%);
        opacity: 1;
    }
    75% { 
        transform: scale(1.015) translate(1%, 0.5%);
        opacity: 0.97;
    }
}

@keyframes starsDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-500px, -500px) rotate(360deg); }
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.6; filter: brightness(1); }
    50% { opacity: 0.8; filter: brightness(1.4); }
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group textarea,
.input-group select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

.input-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.login-error {
    color: var(--accent);
    font-size: 14px;
    min-height: 20px;
}

.login-hint {
    color: var(--text-muted);
    font-size: 13px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
}

.login-hint strong {
    color: var(--text-secondary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    height: 100vh;
    position: relative;
}

.app.hidden {
    display: none;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 28px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-xp {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.xp-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.xp-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: var(--xp-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border-left-color: var(--accent);
}

.nav-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-badge:empty {
    display: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.page {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    padding-bottom: calc(32px + var(--bottom-bar-height));
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 24px;
}

.page-title-tag {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.stats-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.stats-table tr:hover td {
    background: var(--bg-hover);
}

.stats-table .eventologist-name {
    font-weight: 600;
}

.stats-table .role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.role-admin { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
.role-eventologist { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.role-deputy { background: rgba(155, 89, 182, 0.2); color: #9b59b6; }

.stat-number {
    font-weight: 700;
    font-size: 18px;
}

.stat-success { color: var(--success); }
.stat-fail { color: var(--accent); }
.stat-neutral { color: var(--text-secondary); }
.stat-money { color: var(--warning); }

/* ===== EVENTS LIST ===== */
.events-list {
    padding: 16px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    transition: var(--transition);
}

.event-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.event-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.event-info {
    flex: 1;
}

.event-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.event-meta {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.event-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active { background: rgba(39, 174, 96, 0.2); color: #27ae60; }
.status-planned { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.status-cancelled { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }

.event-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.event-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== EVENTOLOGISTS LIST ===== */
.eventologists-list {
    padding: 16px;
}

.eventologist-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.eventologist-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 2px solid var(--border-color);
}

.eventologist-info {
    flex: 1;
}

.eventologist-name {
    font-weight: 600;
    font-size: 16px;
}

.eventologist-details {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.eventologist-xp {
    text-align: right;
}

.eventologist-xp-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.eventologist-xp-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== MESSENGER ===== */
.messenger-card {
    height: calc(100vh - 220px);
    min-height: 400px;
}

.messenger-layout {
    display: flex;
    height: 100%;
}

.messenger-contacts {
    width: 280px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.contact-item:hover {
    background: var(--bg-hover);
}

.contact-item.active {
    background: var(--accent-glow);
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-role {
    font-size: 12px;
    color: var(--text-muted);
}

.messenger-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messenger-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.message.own {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.other {
    align-self: flex-start;
    background: var(--bg-hover);
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.message-time {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
    text-align: right;
}

.message.other .message-time {
    color: var(--text-muted);
}

.messenger-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.messenger-input-area input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.messenger-input-area input:focus {
    border-color: var(--accent);
}

/* ===== LAUNCH FORM ===== */
.launch-form {
    padding: 24px;
    max-width: 600px;
}

/* ===== USERS LIST ===== */
.users-list {
    padding: 16px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.user-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.user-item-info {
    flex: 1;
}

.user-item-name {
    font-weight: 600;
    font-size: 15px;
}

.user-item-login {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.user-item-actions {
    display: flex;
    gap: 8px;
}

/* ===== METHODOLOGY ===== */
.methodology-content {
    padding: 32px;
    max-width: 800px;
    line-height: 1.6;
}

.methodology-content h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--accent);
}

.methodology-content h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 12px;
}

.methodology-content ul,
.methodology-content ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.methodology-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.methodology-content strong {
    color: var(--text-primary);
}

/* ===== BOTTOM BAR ===== */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--bottom-bar-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 13px;
    color: var(--text-secondary);
    z-index: 100;
}

.bottom-bar .separator {
    margin: 0 12px;
    color: var(--border-color);
}

.bottom-bar span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== TOASTS ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--accent); }
.toast-info { border-left: 4px solid var(--info); }

.toast-message {
    flex: 1;
    font-size: 14px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body .btn {
    margin-top: 16px;
}

/* ===== TEXT UTILITIES ===== */
.text-muted {
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-title,
    .user-info,
    .user-xp,
    .nav-section,
    .nav-item span:not(.nav-icon),
    .sidebar-footer {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .bottom-bar {
        left: 70px;
    }
}
