:root {
    /* Modo Oscuro (Default) */
    --bg-color: #0b1120;
    --card-bg: #161e31;
    --nav-bg: #161e31;
    --text-color: #f3f4f6;
    --text-muted: #94a3b8;
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --border-color: rgba(255, 255, 255, 0.05);
    --accent: #3b82f6;
}

[data-theme="light"] {
    /* Modo Claro */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --nav-bg: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.1);
    --border-color: #e2e8f0;
    --accent: #2563eb;
}

* {
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

html {
    overflow-x: hidden;
    width: 100%;
}

/* Navigation */
.navbar {
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-color);
}

.logo-icon {
    color: var(--primary);
    display: flex;
    align-items: center;
}

.nav-menu li {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 1.5rem 0.8rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-color);
}

.nav-link svg.chevron {
    width: 12px;
    height: 12px;
    opacity: 0.5;
}

/* Dropdown Menu Styles */
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
    padding: 0.5rem;
    display: none;
    z-index: 1000;
}

.nav-menu li:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

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

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

/* User controls */
.vehicle-selector {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-level {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.avatar {
    width: 35px;
    height: 35px;
    background: #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
}

/* Hamburger Menu Icon */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    margin-right: 0.5rem;
}

/* Side Menu Mobile */
.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--nav-bg);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 25px rgba(0,0,0,0.2);
}

.side-menu.active {
    transform: translateX(0);
}

.side-menu-header {
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.side-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 0.2rem;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.side-link:hover, .side-link.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.side-link svg {
    opacity: 0.7;
}

.side-group {
    margin-top: 1rem;
}

.side-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
}

.side-group-title:hover {
    background: rgba(255, 255, 255, 0.03);
}

.side-group-title svg {
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.side-group.active .side-group-title svg {
    transform: rotate(180deg);
}

.side-group-links {
    max-height: 0;
    overflow: hidden;
    padding-left: 1rem;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.side-group.active .side-group-links {
    max-height: 1000px; /* Big enough for any menu */
    opacity: 1;
    margin-top: 5px;
}

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



.close-menu {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* Main Layout */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1rem;
    }
    .page-header > div {
        order: 2;
    }
    .page-header button {
        order: 1;
        width: 100%;
        justify-content: center;
    }
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 350px repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
}

/* Table Responsiveness */
.table-container {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 800px; /* Force scroll on very small screens */
}

.data-table thead {
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    padding: 1.2rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.data-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}



.card {
    background-color: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.vehicle-card {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
}

.vehicle-img {
    width: 100%;
    height: 200px;
    border-radius: 15px;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-color);
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 45%;
}

.total-gasto-card {
    background: var(--primary);
    color: white;
}

.total-gasto-card .card-title,
.total-gasto-card .card-footer {
    color: rgba(255, 255, 255, 0.8);
}

/* Vehicle Card V2 (Vertical Style) */
.vehicle-card-v2 {
    background-color: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 24px;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.card-img-container {
    padding: 10px;
    position: relative;
}

.card-img-v2 {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 18px;
}

.brand-overlay {
    position: absolute;
    top: 25px;
    left: 25px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.card-body-v2 {
    padding: 1.5rem;
}

.vehicle-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.vehicle-info-row svg {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.guantera-digital {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.guantera-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.guantera-label { color: var(--text-muted); }
.guantera-value { font-weight: 600; color: var(--accent); }

.btn-actions-grid {
    display: grid;
    grid-template-cols: 1fr 1fr;
    gap: 10px;
    margin-top: 1.5rem;
}

.btn-v2 {
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success-v2 { background: var(--primary); color: white; }
.btn-outline-v2 { border: 1px solid var(--border-color); color: var(--text-color); background: none; }
.btn-light-v2 { background: rgba(255,255,255,0.05); color: var(--text-color); }
.btn-danger-v2 { background: #ef4444; color: white; }

.btn-icon {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon.btn-view {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}
.btn-icon.btn-view:hover {
    background: var(--accent);
    color: white;
}

.btn-icon.btn-edit {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}
.btn-icon.btn-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-icon.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.btn-icon.btn-delete:hover {
    background: #ef4444;
    color: white;
}

.btn-full-v2 {
    grid-column: span 2;
}

/* Responsive Utilities */
.hide-mobile {
    display: table-cell;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

.responsive-card-content {
    padding: 2.5rem;
}

@media (max-width: 768px) {
    .responsive-card-content {
        padding: 1.5rem !important;
    }
}

/* Form Layouts */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

@media (max-width: 850px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-control {
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal-content {
    background: var(--card-bg);
    max-width: 600px;
    width: 100%;
    border-radius: 28px;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 1.5rem 2rem;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-body {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Modal Transitions */
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.total-cost-card {
  grid-column: span 3;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  background-color: #10b981 !important;
  color: white !important;
}

@media (max-width: 1024px) {
  .total-cost-card {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .total-cost-card {
    grid-column: span 1;
  }
}

/* Footer Modern Redesign */
.main-footer {
    background: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.8rem 0;
    margin-top: auto;
    width: 100%;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.8;
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

.footer-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.footer-menu a:hover {
    color: var(--primary);
    opacity: 1;
}

.footer-theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.footer-theme-toggle:hover {
    opacity: 1;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .vehicle-card {
        grid-row: span 1;
    }
}

@media (max-width: 1024px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-menu, .badge-level, .avatar {
        display: none !important;
    }

    .hamburger {
        display: block;
    }

    .nav-left, .nav-right {
        gap: 0.5rem;
    }

    .logo {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.2rem;
        margin: 1rem auto;
    }
    
    .side-menu {
        width: 70vw;
    }

    .dashboard-grid, .btn-actions-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.2rem;
    }

    .page-header .btn-v2 {
        width: 100%;
        justify-content: center;
    }

    .modal-overlay {
        padding: 20px 10px;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .table-container {
        border-radius: 15px;
    }/* Responsive Utilities */
@media (max-width: 768px) {
    .container {
        padding: 1rem !important;
    }
    
    .stack-mobile {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    .page-header h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    .page-header p {
        font-size: 1rem !important;
    }

    .card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
        margin-bottom: 1.5rem;
    }

    .side-group-header {
        padding: 0.8rem 1rem !important;
        gap: 8px !important;
    }

    .side-group-header span {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.75rem !important;
    }
} 

    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 2rem 1rem;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .footer-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }

    /* Small screen table font size adjust */
    .data-table th, .data-table td {
        padding: 1rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 0.8rem;
    }

    .side-menu {
        width: 85vw;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }

    .container {
        padding: 0 0.8rem;
    }
}
