/* sidebar.css - Sidebar e sistema di navigazione */
/* UPDATED: Better mobile experience + scaled down for smaller screens */

/* === SIDEBAR STYLES === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 78px;
    background: #11101D;
    padding: 6px 14px;
    z-index: 99;
    transition: all 0.5s ease;
}

.sidebar.open {
    width: 250px;
}

.sidebar .logo-details {
    height: 60px;
    display: flex;
    align-items: center;
    position: relative;
}

.sidebar .logo-details .masterball {
    opacity: 0;
    transition: all 0.5s ease;
}

.sidebar .logo-details .logo_name {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.5s ease;
}

.sidebar.open .logo-details .masterball,
.sidebar.open .logo-details .logo_name {
    opacity: 1;
}

.sidebar .logo-details #btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    font-size: 22px;
    transition: all 0.4s ease;
    text-align: center;
    cursor: pointer;
    color: #fff;
}

.sidebar.open .logo-details #btn {
    text-align: right;
}

.sidebar i {
    color: #fff;
    height: 60px;
    min-width: 50px;
    font-size: 28px;
    text-align: center;
    line-height: 60px;
}

.sidebar .nav-list {
    margin-top: 20px;
    height: 100%;
}

.sidebar li {
    position: relative;
    margin: 8px 0;
    list-style: none;
}

.sidebar li .tooltip {
    position: absolute;
    top: -20px;
    left: calc(100% + 15px);
    z-index: 3;
    background: #fff;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 400;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
    transition: 0s;
    color: #000;
}

.sidebar li:hover .tooltip {
    opacity: 1;
    pointer-events: auto;
    transition: all 0.4s ease;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar.open li .tooltip {
    display: none;
}

.sidebar input {
    font-size: 15px;
    color: #FFF;
    font-weight: 400;
    outline: none;
    height: 50px;
    width: 50px;
    border: none;
    border-radius: 12px;
    transition: all 0.5s ease;
    background: #1d1b31;
}

.sidebar.open input {
    padding: 0 20px 0 50px;
    width: 100%;
}

.sidebar .bx-search {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    font-size: 22px;
    background: #1d1b31;
    color: #FFF;
    cursor: pointer;
    z-index: 2;
    border-radius: 12px;
}

.sidebar.open .bx-search:hover {
    background: #1d1b31;
    color: #FFF;
}

.sidebar .bx-search:hover {
    background: #FFF;
    color: #11101d;
}

.sidebar li a {
    display: flex;
    height: 100%;
    width: 100%;
    border-radius: 12px;
    align-items: center;
    text-decoration: none;
    transition: all 0.4s ease;
    background: #11101D;
    cursor: pointer;
}

.sidebar li a:hover {
    background: #FFF;
}

/* === EVIDENZIAZIONE PAGINA CORRENTE === */
.sidebar li.active a {
    background: #4CAF50 !important;
    color: #fff;
}

.sidebar li.active a:hover {
    background: #45a049 !important;
}

.sidebar li.active a .links_name,
.sidebar li.active a i {
    color: #fff !important;
}

.sidebar li.active .tooltip {
    background: #4CAF50;
    color: #fff;
}

.sidebar li a .links_name {
    color: #fff;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s;
}

.sidebar.open li a .links_name {
    opacity: 1;
    pointer-events: auto;
}

.sidebar li a:hover .links_name,
.sidebar li a:hover i {
    transition: all 0.5s ease;
    color: #11101D;
}

.sidebar li i {
    height: 50px;
    line-height: 50px;
    font-size: 18px;
    border-radius: 12px;
}

.sidebar li.profile {
    position: fixed;
    height: 60px;
    width: 78px;
    left: 0;
    bottom: -8px;
    padding: 10px 14px;
    background: #1d1b31;
    transition: all 0.5s ease;
    overflow: hidden;
}

.sidebar.open li.profile {
    width: 250px;
}

.sidebar li .profile-details {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.sidebar li img {
    height: 45px;
    width: 45px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 10px;
}

.sidebar li.profile .name,
.sidebar li.profile .job {
    font-size: 15px;
    font-weight: 400;
    color: #fff;
    white-space: nowrap;
}

.sidebar li.profile .job {
    font-size: 12px;
}

.sidebar .profile #log_out {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: #1d1b31;
    width: 100%;
    height: 60px;
    line-height: 60px;
    border-radius: 0px;
    transition: all 0.5s ease;
    cursor: pointer;
}

.sidebar.open .profile #log_out {
    width: 50px;
    background: none;
}

/* === RESPONSIVE - SMALLER DESKTOP/LAPTOP (1920x1080 and below) === */
@media (max-width: 1920px) {
    .sidebar {
        width: 70px;
        padding: 5px 12px;
    }
    
    .sidebar.open {
        width: 220px;
    }
    
    .sidebar .logo-details {
        height: 50px;
    }
    
    .sidebar .logo-details .logo_name {
        font-size: 18px;
    }
    
    .sidebar i {
        height: 50px;
        min-width: 45px;
        font-size: 24px;
        line-height: 50px;
    }
    
    .sidebar li {
        margin: 6px 0;
    }
    
    .sidebar li i {
        height: 45px;
        line-height: 45px;
        font-size: 16px;
    }
    
    .sidebar input {
        height: 45px;
        font-size: 14px;
    }
    
    .sidebar li a .links_name {
        font-size: 14px;
    }
    
    .sidebar li.profile {
        height: 55px;
        width: 70px;
        padding: 8px 12px;
    }
    
    .sidebar.open li.profile {
        width: 220px;
    }
    
    .sidebar li img {
        height: 40px;
        width: 40px;
    }
    
    .sidebar li.profile .name {
        font-size: 14px;
    }
    
    .sidebar li.profile .job {
        font-size: 11px;
    }
}

/* === RESPONSIVE - LAPTOP (1280x800 and similar) === */
@media (max-width: 1440px) {
    .sidebar {
        width: 65px;
        padding: 4px 10px;
    }
    
    .sidebar.open {
        width: 200px;
    }
    
    .sidebar .logo-details {
        height: 45px;
    }
    
    .sidebar .logo-details .logo_name {
        font-size: 16px;
    }
    
    .sidebar i {
        height: 45px;
        min-width: 40px;
        font-size: 22px;
        line-height: 45px;
    }
    
    .sidebar li {
        margin: 5px 0;
    }
    
    .sidebar li i {
        height: 40px;
        line-height: 40px;
        font-size: 15px;
    }
    
    .sidebar input {
        height: 40px;
        font-size: 13px;
    }
    
    .sidebar li a .links_name {
        font-size: 13px;
    }
    
    .sidebar li.profile {
        height: 50px;
        width: 65px;
        padding: 6px 10px;
    }
    
    .sidebar.open li.profile {
        width: 200px;
    }
    
    .sidebar li img {
        height: 35px;
        width: 35px;
    }
    
    .sidebar li.profile .name {
        font-size: 13px;
    }
    
    .sidebar li.profile .job {
        font-size: 10px;
    }
}

/* === RESPONSIVE - TABLET (768px - 1024px) === */
@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
        padding: 4px 8px;
    }
    
    .sidebar.open {
        width: 200px;
        padding: 6px 12px;
    }
    
    .sidebar li.profile {
        width: 60px;
    }
    
    .sidebar.open li.profile {
        width: 200px;
    }
}

/* === RESPONSIVE - MOBILE (below 768px) === */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        padding: 0;
        transform: translateX(-100%);
        background: #11101D !important; /* SOLID background */
        overflow: hidden; /* Hide all content when closed */
        transition: transform 0.3s ease, width 0.3s ease;
    }
    
    .sidebar.open {
        width: 280px;
        max-width: 85vw;
        padding: 10px 16px;
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.8);
        background: #11101D !important; /* SOLID background - NOT transparent */
        z-index: 1000; /* Above overlay */
        overflow: visible;
    }
    
    .sidebar .logo-details {
        height: 55px;
    }
    
    .sidebar .logo-details .logo_name {
        font-size: 18px;
    }
    
    .sidebar .logo-details #btn {
        font-size: 26px;
    }
    
    .sidebar i {
        height: 55px;
        min-width: 45px;
        font-size: 24px;
        line-height: 55px;
    }
    
    .sidebar li {
        margin: 8px 0;
    }
    
    .sidebar li i {
        height: 50px;
        line-height: 50px;
        font-size: 18px;
    }
    
    .sidebar input {
        height: 50px;
        font-size: 16px;
    }
    
    .sidebar li a .links_name {
        font-size: 16px;
    }
    
    .sidebar li .tooltip {
        display: none !important;
    }
    
    .sidebar li.profile {
        position: fixed;
        height: 65px;
        width: 0;
        padding: 0;
        bottom: 0;
        left: 0;
    }
    
    .sidebar.open li.profile {
        width: 280px;
        max-width: 85vw;
        padding: 12px 16px;
    }
    
    .sidebar li img {
        height: 42px;
        width: 42px;
    }
    
    .sidebar li.profile .name {
        font-size: 15px;
    }
    
    .sidebar li.profile .job {
        font-size: 12px;
    }
    
    .sidebar .profile #log_out {
        height: 65px;
        line-height: 65px;
    }
    
    .sidebar.open .profile #log_out {
        width: 50px;
    }
}

/* === MOBILE OVERLAY === */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 999; /* Below sidebar (1000) but above content */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* No transition - instant show/hide to prevent flash */
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* === MOBILE MENU TOGGLE BUTTON (hamburger) === */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 100;
    width: 45px;
    height: 45px;
    background: #11101D;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle i {
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hide when sidebar is open */
    .sidebar.open ~ .mobile-menu-toggle {
        display: none;
    }
}

/* === SETTINGS ICON IN PROFILE === */
.sidebar .settings-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: #2d2b42;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    color: #fff;
}

.sidebar .settings-icon:hover {
    background: #fff;
    color: #11101D;
    transform: rotate(45deg);
}

.sidebar .settings-icon svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

/* === SETTINGS MODAL === */
.settings-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.settings-modal-overlay.active {
    display: flex;
}

.settings-modal {
    background: #1d1b31;
    border-radius: 14px;
    width: 90%;
    max-width: 340px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #11101D;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.settings-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.settings-modal-close:hover {
    color: #ff4757;
}

.settings-modal-body {
    padding: 16px 18px;
}

.settings-form-group {
    margin-bottom: 14px;
}

.settings-form-group label {
    display: block;
    color: #aaa;
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: 500;
}

.settings-form-group input {
    width: 100%;
    padding: 10px 14px;
    background: #11101D;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.settings-form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.settings-form-group input::placeholder {
    color: #555;
}

.settings-hint {
    display: block;
    color: #888;
    font-size: 11px;
    margin-top: 6px;
    line-height: 1.4;
}

.settings-cooldown {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

.settings-input {
    width: 100%;
    padding: 10px 14px;
    background: #11101D;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.settings-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.settings-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-input::placeholder {
    color: #555;
}

/* Select dropdown style */
.settings-select {
    width: 100%;
    padding: 10px 14px;
    background: #11101D;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
}

.settings-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.settings-select option {
    background: #11101D;
    color: #fff;
    padding: 10px;
}

/* Discord section */
.settings-discord-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.settings-discord-text {
    color: #888;
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.settings-discord-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #5865F2;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.settings-discord-btn:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.settings-discord-btn svg {
    flex-shrink: 0;
}

.settings-error {
    color: #ff4757;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}

.settings-success {
    color: #4CAF50;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}

.settings-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 18px 16px;
    justify-content: flex-end;
}

.settings-btn-cancel,
.settings-btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.settings-btn-cancel {
    background: #2d2b42;
    color: #aaa;
}

.settings-btn-cancel:hover {
    background: #3d3b52;
    color: #fff;
}

.settings-btn-save {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: #fff;
}

.settings-btn-save:hover {
    background: linear-gradient(135deg, #5CBF60, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.settings-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive adjustments for settings */
@media (max-width: 1920px) {
    .sidebar .settings-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .sidebar .settings-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 1440px) {
    .sidebar .settings-icon {
        width: 35px;
        height: 35px;
        min-width: 35px;
    }
    
    .sidebar .settings-icon svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 768px) {
    .sidebar .settings-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }
    
    .sidebar .settings-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .settings-modal {
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
}
