/* ===== DASHBOARD CONSULENTI - Yoyomove.ai ===== */
/* Dark theme + accenti gialli */

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

body {
    font-family: 'Poppins', sans-serif;
    background: #0a0a0a;
    color: #fff;
    min-height: 100vh;
}

/* Auth Loading */
.auth-loading {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #0a0a0a; display: flex; align-items: center;
    justify-content: center; flex-direction: column; z-index: 9999;
}
.auth-loading.hidden { display: none; }
.auth-spinner {
    width: 50px; height: 50px;
    border: 3px solid rgba(255, 193, 7, 0.2);
    border-top: 3px solid #FFC107;
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-loading-text { margin-top: 1rem; color: rgba(255,255,255,0.6); font-family: 'Poppins', sans-serif; }
.app-content { display: none; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; left: 0; top: 0; width: 260px; height: 100vh;
    background: rgba(15, 15, 15, 0.98);
    border-right: 2px solid rgba(255, 193, 7, 0.2);
    padding: 1.5rem; z-index: 100;
    display: flex; flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    display: flex; align-items: center; gap: 0.8rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    margin-bottom: 1.5rem;
}
.sidebar-logo img { width: 36px; height: 36px; }
.sidebar-logo span {
    font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 700;
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.sidebar-user {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 1rem; margin-bottom: 1.5rem;
    background: rgba(255, 193, 7, 0.05);
    border-radius: 12px; border: 1px solid rgba(255, 193, 7, 0.1);
}
.sidebar-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #FFC107, #8A2BE2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #000; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: #fff; }
.sidebar-user-team { font-size: 0.75rem; color: #888; }

.sidebar-nav {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    margin-right: -0.5rem; padding-right: 0.5rem;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 193, 7, 0.2); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 193, 7, 0.4); }

.nav-section { margin-bottom: 1.5rem; }
.nav-section-title {
    font-size: 0.7rem; color: #666; text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 0.5rem; padding-left: 0.5rem;
}

.nav-item {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.8rem 1rem; border-radius: 10px; color: #aaa;
    text-decoration: none; transition: all 0.2s ease;
    margin-bottom: 0.2rem; cursor: pointer; font-size: 0.9rem;
}
.nav-item:hover { background: rgba(255, 193, 7, 0.1); color: #FFC107; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(138, 43, 226, 0.1));
    color: #FFC107; font-weight: 600;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-item.coming-soon {
    opacity: 0.4; pointer-events: none; position: relative;
}
.nav-item.coming-soon::after {
    content: 'Coming Soon';
    font-size: 0.55rem; font-weight: 600; text-transform: uppercase;
    background: rgba(255, 193, 7, 0.2); color: #FFC107;
    padding: 0.1rem 0.4rem; border-radius: 4px;
    margin-left: auto;
}

.sidebar-footer { margin-top: auto; }
.logout-btn {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.8rem 1rem; border-radius: 10px;
    color: #ef4444; cursor: pointer; transition: all 0.2s ease;
    border: none; background: none; width: 100%;
    font-family: 'Poppins', sans-serif; font-size: 0.9rem;
}
.logout-btn:hover { background: rgba(239, 68, 68, 0.1); }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px; padding: 2rem;
    min-height: 100vh;
}

.page-header { margin-bottom: 2rem; }
.page-title {
    font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.page-subtitle { color: #888; font-size: 0.9rem; margin-top: 0.3rem; }

/* ===== KPI CARDS ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem; margin-bottom: 2rem;
}
.stat-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.15);
    border-radius: 16px; padding: 1.5rem;
    transition: all 0.3s ease;
}
.stat-card:hover {
    border-color: rgba(255, 193, 7, 0.4);
    box-shadow: 0 8px 30px rgba(255, 193, 7, 0.1);
    transform: translateY(-2px);
}
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-value {
    font-family: 'Montserrat', sans-serif; font-size: 1.8rem;
    font-weight: 800; color: #fff; margin-bottom: 0.3rem;
}
.stat-label { font-size: 0.8rem; color: #888; }

/* ===== RANKING WIDGET ===== */
.ranking-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 16px; padding: 1.5rem; margin-bottom: 2rem;
}
.ranking-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.ranking-title { font-size: 1rem; font-weight: 600; color: #fff; }
.ranking-badge {
    background: linear-gradient(135deg, #8A2BE2, #6B21A8);
    padding: 0.4rem 1rem; border-radius: 20px;
    font-size: 0.85rem; font-weight: 700; color: #fff;
}
.ranking-bar-container {
    background: rgba(255, 255, 255, 0.05); border-radius: 8px;
    height: 12px; position: relative; margin: 1rem 0;
}
.ranking-bar-avg {
    position: absolute; height: 100%; background: rgba(255, 255, 255, 0.15);
    border-radius: 8px; transition: width 0.5s ease;
}
.ranking-bar-me {
    position: absolute; height: 100%;
    background: linear-gradient(135deg, #FFC107, #8A2BE2);
    border-radius: 8px; transition: width 0.5s ease;
}
.ranking-legend {
    display: flex; gap: 1.5rem; font-size: 0.8rem; color: #888;
}
.ranking-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot {
    width: 10px; height: 10px; border-radius: 50%;
}
.legend-dot.me { background: linear-gradient(135deg, #FFC107, #8A2BE2); }
.legend-dot.avg { background: rgba(255, 255, 255, 0.15); }

/* ===== CHARTS ===== */
.charts-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem; margin-bottom: 2rem;
}
.chart-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.1);
    border-radius: 16px; padding: 1.5rem;
}
.chart-title {
    font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: #fff;
}
.chart-container { position: relative; height: 250px; }

/* ===== TABLES ===== */
.table-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.1);
    border-radius: 16px; padding: 1.5rem; margin-bottom: 2rem;
}
.table-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem;
}
.table-title { font-size: 1.1rem; font-weight: 600; }

.filters-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.filter-select {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: #fff; padding: 0.5rem 1rem; border-radius: 8px;
    font-family: 'Poppins', sans-serif; font-size: 0.85rem;
    cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #FFC107; }
.filter-select option { background: #1a1a1a; color: #fff; }

.search-input {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: #fff; padding: 0.5rem 1rem; border-radius: 8px;
    font-family: 'Poppins', sans-serif; font-size: 0.85rem;
    min-width: 200px;
}
.search-input:focus { outline: none; border-color: #FFC107; }
.search-input::placeholder { color: #666; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 0.8rem 1rem; text-align: left; font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.data-table th {
    color: #FFC107; font-weight: 600; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table tr { transition: background 0.2s ease; }
.data-table tr:hover { background: rgba(255, 193, 7, 0.05); }
.data-table td { color: #ccc; }

/* Esito badges */
.esito-badge {
    display: inline-block; padding: 0.3rem 0.8rem;
    border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.esito-badge.approved { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.esito-badge.rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.esito-badge.pending { background: rgba(255, 193, 7, 0.15); color: #FFC107; }
.esito-badge.cancelled { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

/* Paginazione */
.table-pagination {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 1rem; padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.pagination-info { font-size: 0.8rem; color: #888; }
.pagination-controls { display: flex; align-items: center; gap: 0.8rem; }
.pagination-btn {
    background: rgba(255, 193, 7, 0.1); border: 1px solid rgba(255, 193, 7, 0.2);
    color: #FFC107; padding: 0.4rem 1rem; border-radius: 8px;
    cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 0.8rem;
    transition: all 0.2s ease;
}
.pagination-btn:hover:not(:disabled) { background: rgba(255, 193, 7, 0.2); }
.pagination-btn:disabled { opacity: 0.3; cursor: default; }
.pagination-current { font-size: 0.8rem; color: #888; }

/* ===== ACTIVITY LIST ===== */
.activity-list { list-style: none; }
.activity-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.activity-item:last-child { border-bottom: none; }
.activity-info { flex: 1; }
.activity-client { font-size: 0.85rem; font-weight: 500; color: #fff; }
.activity-meta { font-size: 0.75rem; color: #888; margin-top: 0.2rem; }
.activity-status { margin-left: 1rem; }

/* ===== PROFILE PAGE ===== */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.profile-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.1);
    border-radius: 16px; padding: 1.5rem;
}
.profile-card-title {
    font-size: 1rem; font-weight: 600; margin-bottom: 1rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 193, 7, 0.1);
}
.profile-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0;
}
.profile-label { font-size: 0.85rem; color: #888; }
.profile-value { font-size: 0.85rem; color: #fff; font-weight: 500; }

/* Form */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block; color: #ccc; font-size: 0.85rem;
    font-weight: 500; margin-bottom: 0.4rem;
}
.form-group input {
    width: 100%; padding: 0.8rem 1rem;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 10px; color: #fff;
    font-family: 'Poppins', sans-serif; font-size: 0.9rem;
    transition: all 0.2s ease;
}
.form-group input:focus { outline: none; border-color: #FFC107; }

.btn-primary {
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    color: #000; border: none; padding: 0.8rem 1.5rem;
    border-radius: 10px; font-family: 'Poppins', sans-serif;
    font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255, 193, 7, 0.3); }

.btn-secondary {
    background: rgba(255, 193, 7, 0.1); border: 1px solid rgba(255, 193, 7, 0.3);
    color: #FFC107; padding: 0.8rem 1.5rem; border-radius: 10px;
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: all 0.3s ease;
}
.btn-secondary:hover { background: rgba(255, 193, 7, 0.2); }

.btn-danger {
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444; padding: 0.6rem 1.2rem; border-radius: 8px;
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.8rem;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-success {
    background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e; padding: 0.6rem 1.2rem; border-radius: 8px;
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.8rem;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-success:hover { background: rgba(34, 197, 94, 0.2); }

/* ===== TOAST ===== */
.toast-notification {
    position: fixed; bottom: 2rem; right: 2rem;
    padding: 1rem 1.5rem; border-radius: 12px;
    font-family: 'Poppins', sans-serif; font-size: 0.9rem;
    z-index: 10000; transform: translateY(100px);
    opacity: 0; transition: all 0.3s ease;
}
.toast-notification.show { transform: translateY(0); opacity: 1; }
.toast-success { background: rgba(34, 197, 94, 0.9); color: #fff; }
.toast-error { background: rgba(239, 68, 68, 0.9); color: #fff; }
.toast-info { background: rgba(59, 130, 246, 0.9); color: #fff; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 3rem; color: #666;
}

/* ===== MOBILE HAMBURGER ===== */
.mobile-header {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%;
    background: rgba(10, 10, 10, 0.95); backdrop-filter: blur(10px);
    padding: 1rem 1.5rem; z-index: 101;
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    align-items: center; justify-content: space-between;
}
.hamburger-btn {
    background: none; border: none; color: #FFC107;
    font-size: 1.5rem; cursor: pointer;
}
.mobile-logo {
    font-family: 'Montserrat', sans-serif; font-size: 1.1rem; font-weight: 700;
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 5rem 1rem 2rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .data-table th, .data-table td { padding: 0.6rem 0.5rem; font-size: 0.78rem; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .filters-row { width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.5rem; }
}

/* ===== CARDS / PREMI PAGE ===== */
.collection-summary {
    flex-wrap: wrap;
}
@media (max-width: 768px) {
    .collection-summary { flex-direction: column; gap: 1rem; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 0.8rem !important; }
    .reward-card { padding: 1rem; }
    .card-emoji { font-size: 2.2rem; }
    .card-name { font-size: 0.85rem; }
    .card-desc { font-size: 0.7rem; }
}
@media (max-width: 400px) {
    .cards-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Chat button nella tabella */
.chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.chat-btn:hover { background: rgba(59, 130, 246, 0.25); border-color: #3b82f6; }
.chat-btn .chat-icon { font-size: 1.2rem; }
.chat-btn.has-unread {
    background: rgba(240, 180, 41, 0.15);
    border-color: #f0b429;
    animation: chatPulse 2s infinite;
}
.chat-btn.has-messages { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.4); }
.chat-badge {
    background: #f0b429;
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.chat-count {
    color: #90caf9;
    font-size: 0.75rem;
    font-weight: 600;
}
@keyframes chatPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, 0.3); }
    50% { box-shadow: 0 0 8px 2px rgba(240, 180, 41, 0.2); }
}

/* Chat panel */
.chat-panel {
    position: fixed;
    z-index: 1000;
    width: 350px;
    height: 440px;
    background: #12121a;
    border: 1px solid #3b82f6;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}
.chat-title { font-weight: 700; font-size: 0.95rem; color: #3b82f6; }
.chat-subtitle { font-size: 0.8rem; color: #888; margin-top: 2px; }
.chat-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.chat-close:hover { color: #fff; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-loading, .chat-empty {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}
.chat-msg-cs {
    align-self: flex-start;
    background: rgba(240, 180, 41, 0.1);
    border: 1px solid rgba(240, 180, 41, 0.25);
}
.chat-msg-me {
    align-self: flex-end;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.chat-msg-name {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 3px;
}
.chat-msg-cs .chat-msg-name { color: #f0b429; }
.chat-msg-me .chat-msg-name { color: #3b82f6; }
.chat-msg-text { color: #e0e0e0; word-break: break-word; }
.chat-msg-time { font-size: 0.68rem; color: #666; margin-top: 4px; text-align: right; }

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #1e1e2e;
    background: #0a0a1a;
}
.chat-input-area textarea {
    flex: 1;
    background: #12121a;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    color: #e0e0e0;
    padding: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
}
.chat-input-area textarea:focus { border-color: #3b82f6; outline: none; }
.chat-send {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    align-self: flex-end;
}
.chat-send:hover { background: #2563eb; }
