@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css');

/* =============================================================================
   ESTILOS GLOBALES Y RESET
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(135deg, #1b1b2f, #162447);
    color: #eaeaea;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =============================================================================
   SIDEBAR COMMAND CENTER
   ============================================================================= */
.menu {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 280px; /* Reduced from 320px */
    background: linear-gradient(135deg, 
        rgba(138, 43, 226, 0.15) 0%, 
        rgba(22, 36, 71, 0.95) 30%, 
        rgba(17, 16, 29, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(118, 199, 192, 0.2);
    z-index: 100;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar.close {
    width: 78px;
}

/* =============================================================================
   COMMAND HEADER
   ============================================================================= */
.command-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(118, 199, 192, 0.2);
    background: linear-gradient(135deg, 
        rgba(118, 199, 192, 0.1), 
        rgba(138, 43, 226, 0.05));
    position: relative;
}

.sidebar.close .command-header {
    padding: 20px 12px;
}

.logo-section {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #76c7c0, #4facfe);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #1c1c1c;
    margin-right: 12px;
    box-shadow: 0 8px 20px rgba(118, 199, 192, 0.3);
    transition: all 0.3s ease;
}

.sidebar.close .logo-icon {
    margin-right: 0;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: #76c7c0;
    opacity: 1;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sidebar.close .logo-text {
    opacity: 0;
    pointer-events: none;
}

/* =============================================================================
   ORBES SECTION
   ============================================================================= */
.orbes-section {
    margin-bottom: 20px;
    position: relative;
}

.orbes-display {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(118, 199, 192, 0.15), 
        rgba(79, 172, 254, 0.1));
    border: 1px solid rgba(118, 199, 192, 0.3);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.orbes-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(118, 199, 192, 0.2);
    border-color: rgba(118, 199, 192, 0.5);
}

.orbes-icon {
    font-size: 20px;
    margin-right: 10px;
    color: #76c7c0;
    text-shadow: 0 0 10px rgba(118, 199, 192, 0.5);
    transition: all 0.3s ease;
}

.sidebar.close .orbes-icon {
    margin-right: 0;
    font-size: 18px;
}

.orbes-info {
    flex: 1;
    text-align: left;
    transition: all 0.3s ease;
}

.sidebar.close .orbes-info {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.orbes-count {
    font-size: 20px;
    font-weight: 700;
    color: #76c7c0;
    line-height: 1;
    text-shadow: 0 0 10px rgba(118, 199, 192, 0.3);
}

.orbes-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* =============================================================================
   FREE TIER PROGRESS
   ============================================================================= */
.tier-progress {
    margin-top: 15px;
    opacity: 1;
    transition: all 0.3s ease;
}

.sidebar.close .tier-progress {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin-top: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tier-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-count {
    font-size: 10px;
    color: #76c7c0;
    font-weight: 600;
}

.progress-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #76c7c0);
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 3s infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.upgrade-hint {
    margin-top: 8px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* =============================================================================
   QUICK ACTIONS
   ============================================================================= */
.quick-actions {
    margin-top: 12px;
    display: flex;
    gap: 6px;
    opacity: 1;
    transition: all 0.3s ease;
}

.sidebar.close .quick-actions {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin-top: 0;
}

.quick-btn {
    flex: 1;
    background: rgba(118, 199, 192, 0.1);
    border: 1px solid rgba(118, 199, 192, 0.2);
    color: #76c7c0;
    font-size: 9px;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.quick-btn:hover {
    background: rgba(118, 199, 192, 0.2);
    border-color: rgba(118, 199, 192, 0.4);
    transform: translateY(-1px);
}

.quick-btn.primary {
    background: linear-gradient(135deg, #76c7c0, #4facfe);
    color: #1c1c1c;
    border-color: #76c7c0;
    font-weight: 600;
}

/* =============================================================================
   NAVIGATION LINKS
   ============================================================================= */
.nav-links {
    height: calc(100% - 240px); /* Adjusted height */
    padding: 15px 0 120px 0;
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.sidebar.close .nav-links {
    overflow: visible;
    height: calc(100% - 140px);
}

.nav-links li {
    position: relative;
    list-style: none;
    transition: all 0.4s ease;
    margin-bottom: 2px;
}

.nav-links li:hover {
    background: rgba(118, 199, 192, 0.05);
    border-radius: 12px;
    margin: 0 8px 2px 8px;
}

/* Icon Link Structure */
.icon-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar.close .icon-link {
    justify-content: center;
    padding: 12px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.sidebar.close .nav-links li a {
    justify-content: center;
    padding: 12px;
}

.nav-links li i {
    min-width: 32px;
    font-size: 16px;
    text-align: center;
    color: rgba(118, 199, 192, 0.8);
    transition: all 0.3s ease;
}

.nav-links li:hover i {
    color: #76c7c0;
}

.nav-links li a .link_name {
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
    opacity: 1;
    transition: all 0.3s ease;
}

.sidebar.close .nav-links li a .link_name {
    opacity: 0;
    pointer-events: none;
}

/* Arrow Icon */
.arrow {
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    transition: all 0.3s ease;
    min-width: auto !important;
}

.sidebar.close .arrow {
    display: none;
}

/* =============================================================================
   SUBMENU STYLES
   ============================================================================= */
.sub-menu {
    background: rgba(22, 36, 71, 0.7);
    border-radius: 8px;
    margin: 5px 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.showMenu .sub-menu {
    max-height: 500px; /* Increased for generator form */
    opacity: 1;
    padding: 8px 0;
}

.sub-menu li {
    margin-bottom: 0;
}

.sub-menu a {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 12px !important;
    padding: 8px 20px !important;
    transition: all 0.3s ease;
}

.sub-menu a:hover {
    color: #76c7c0 !important;
    background: rgba(118, 199, 192, 0.1);
    border-radius: 6px;
    margin: 0 8px;
}

/* Collapsed submenu */
.sidebar.close .sub-menu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    margin: 0;
    padding: 10px;
    border-radius: 0 8px 8px 0;
    background: rgba(22, 36, 71, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(118, 199, 192, 0.2);
    box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.3);
}

.sidebar.close .nav-links li:hover .sub-menu {
    opacity: 1;
    max-height: 500px;
    pointer-events: auto;
}

/* =============================================================================
   GATE STATUS INDICATORS
   ============================================================================= */
.gate-status {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.gate-status.active {
    background: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    animation: pulse 2s infinite ease-in-out;
}

.gate-status.charging {
    background: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    animation: pulse 2s infinite ease-in-out;
}

.gate-status.offline {
    background: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.3); 
    }
}

/* =============================================================================
   GENERATOR FORM (IMPROVED)
   ============================================================================= */
.generator-form {
    padding: 15px !important;
    background: rgba(17, 16, 29, 0.7) !important;
    border-radius: 10px !important;
    margin: 8px !important;
    border: 1px solid rgba(118, 199, 192, 0.2);
}

.input-field {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(118, 199, 192, 0.3);
    border-radius: 6px;
    background: rgba(60, 60, 60, 0.8);
    color: #e0e0e0;
    font-size: 12px;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #76c7c0;
    box-shadow: 0 0 0 2px rgba(118, 199, 192, 0.2);
    background: rgba(60, 60, 60, 1);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin: 10px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    accent-color: #76c7c0;
}

.btn-custom {
    width: 100%;
    background: linear-gradient(135deg, #76c7c0, #4facfe);
    color: #1c1c1c;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(118, 199, 192, 0.3);
    background: linear-gradient(135deg, #5fb3ab, #4facfe);
}

/* =============================================================================
   PROFILE SECTION
   ============================================================================= */
.profile-details {
    position: fixed;
    bottom: 0;
    width: 280px; /* Match sidebar width */
    background: linear-gradient(135deg, 
        rgba(22, 36, 71, 0.95), 
        rgba(17, 16, 29, 0.98));
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(118, 199, 192, 0.2);
    padding: 15px;
    transition: all 0.5s ease;
}

.sidebar.close .profile-details {
    width: 78px;
    padding: 15px 12px;
}

.profile-content {
    display: flex;
    align-items: center;
}

.profile-details img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    margin-right: 12px;
    border: 2px solid rgba(118, 199, 192, 0.3);
    transition: all 0.3s ease;
}

.sidebar.close .profile-details img {
    margin-right: 0;
    width: 38px;
    height: 38px;
}

.name-job {
    flex: 1;
    opacity: 1;
    transition: all 0.3s ease;
}

.sidebar.close .name-job {
    opacity: 0;
    pointer-events: none;
}

.profile_name {
    color: #76c7c0;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.job {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================================================
   TOGGLE & COLLAPSE
   ============================================================================= */
.toggle-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-item:hover {
    background: rgba(118, 199, 192, 0.05);
}

#toggleIcon {
    transition: transform 0.3s ease;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    background: rgba(22, 36, 71, 0.95);
    color: #76c7c0;
    border: 1px solid rgba(118, 199, 192, 0.3);
    font-size: 18px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    z-index: 101;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(22, 36, 71, 1);
    border-color: #76c7c0;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        left: -280px;
        width: 280px;
    }

    .sidebar.open {
        left: 0;
    }

    .home-section {
        left: 0 !important;
        width: 100% !important;
    }
}

/* =============================================================================
   CONTENT AREA ADJUSTMENTS
   ============================================================================= */
.home-section {
    position: relative;
    left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    transition: all 0.5s ease;
    padding: 20px;
}

.sidebar.close ~ .home-section {
    left: 78px;
    width: calc(100% - 78px);
}

/* =============================================================================
   EXISTING STYLES INTEGRATION - FIXED
   ============================================================================= */

/* Container styles */
.container {
    background-color: rgba(22, 36, 71, 0.8);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(118, 199, 192, 0.1);
    margin: 20px 0;
}

/* Form elements */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="tel"],
select {
    background-color: rgba(60, 60, 60, 0.8);
    border: 1px solid rgba(118, 199, 192, 0.3);
    color: #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
select:focus {
    border-color: #76c7c0;
    box-shadow: 0 0 0 2px rgba(118, 199, 192, 0.2);
}

/* BOTONES - MANTENER ESTILOS ORIGINALES */
/* Solo afectar botones específicos del sidebar, NO todos los botones */
.sidebar button,
.sidebar input[type="submit"] {
    background: linear-gradient(135deg, #76c7c0, #4facfe);
    color: #1c1c1c;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar button:hover,
.sidebar input[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(118, 199, 192, 0.3);
}

/* PRESERVAR ESTILOS GLOBALES ORIGINALES */
/* No tocar los botones fuera del sidebar */
.load-again {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: #4facfe !important;
    color: #1b1b2f !important;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.load-again:hover {
    background-color: #00e6f6 !important;
}

.back-button {
    display: block;
    margin-top: 20px;
    padding: 10px 15px;
    background-color: #76c7c0 !important;
    color: #1c1c1c !important;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
}

.back-button:hover {
    background-color: #5fb3ab !important;
}

/* Botones generales fuera del sidebar */
button:not(.sidebar button):not(.quick-btn):not(.btn-custom):not(.menu-toggle),
input[type="submit"]:not(.sidebar input[type="submit"]) {
    padding: 10px 20px;
    background-color: #76c7c0;
    color: #1c1c1c;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:not(.sidebar button):not(.quick-btn):not(.btn-custom):not(.menu-toggle):hover,
input[type="submit"]:not(.sidebar input[type="submit"]):hover {
    background-color: #5fb3ab;
}

/* Links */
a {
    color: #76c7c0;
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: #4facfe;
    text-decoration: underline;
}

/* Tables */
table {
    background: rgba(22, 36, 71, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(118, 199, 192, 0.2);
}

th {
    background: linear-gradient(135deg, #76c7c0, #4facfe);
    color: #1c1c1c;
    font-weight: 600;
}

td {
    background: rgba(60, 60, 60, 0.3);
    border-color: rgba(118, 199, 192, 0.1);
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.alert-success {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.3);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.3);
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Print styles */
@media print {
    .sidebar,
    .menu-toggle {
        display: none !important;
    }
    
    .home-section {
        left: 0 !important;
        width: 100% !important;
    }
}
