:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --dark-color: #1e1e2f;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #e9ecef;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #f5f6fa;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e1e2f 0%, #2d2d44 100%);
    color: white;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-menu span:not(.badge),
.sidebar.collapsed .progress-card p,
.sidebar.collapsed .progress-card span {
    display: none;
}

.sidebar.collapsed .badge {
    position: absolute;
    top: -5px;
    right: -5px;
}

.sidebar.collapsed .nav-menu a {
    justify-content: center;
    position: relative;
}

.sidebar.collapsed .nav-menu i {
    margin-right: 0;
    font-size: 20px;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 24px;
    color: var(--success-color);
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--success-color);
}

.profile-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.profile-info p {
    font-size: 12px;
    opacity: 0.7;
}

/* Navigation Menu */
.nav-menu {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu li {
    margin: 5px 0;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-menu li.active a {
    background: var(--primary-color);
    color: white;
    border-left: 4px solid var(--success-color);
}

.nav-menu i {
    width: 20px;
    font-size: 18px;
}

.badge {
    background: var(--warning-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-card p {
    font-size: 12px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-bottom: 5px;
}

.progress {
    height: 100%;
    background: var(--success-color);
    border-radius: 3px;
}

.progress-card span {
    font-size: 10px;
    opacity: 0.5;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.menu-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--gray-color);
    cursor: pointer;
    display: none;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light-color);
    padding: 8px 15px;
    border-radius: 20px;
    width: 300px;
}

.search-box i {
    color: var(--gray-color);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn,
.messages-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--gray-color);
    cursor: pointer;
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--warning-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dashboard Content */
.dashboard-content {
    padding: 30px;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 15px;
    padding: 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.welcome-text h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.welcome-text p {
    opacity: 0.9;
}

.date-selector {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.date-selector:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.kpi-icon.revenue {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.kpi-icon.users {
    background: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
}

.kpi-icon.orders {
    background: rgba(247, 37, 133, 0.1);
    color: var(--warning-color);
}

.kpi-icon.conversion {
    background: rgba(63, 55, 201, 0.1);
    color: var(--secondary-color);
}

.kpi-info {
    flex: 1;
}

.kpi-label {
    font-size: 14px;
    color: var(--gray-color);
    display: block;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.kpi-trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.kpi-trend.positive {
    color: #10b981;
}

.kpi-trend.negative {
    color: #ef4444;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Chart Card */
.chart-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

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

.chart-header h3 {
    font-size: 16px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-filter {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    font-size: 12px;
}

.chart-container {
    height: 350px;
    display: flex;
    flex-direction: column;
}

/* Estilos para gráfico de barras - CORREGIDO */
.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 220px;
    padding: 10px 5px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 12px;
    margin-bottom: 15px;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
}

.bar-wrapper {
    width: 30px;
    height: 180px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 15px;
    position: relative;
    margin-bottom: 8px;
}

.bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(180deg, #4361ee, #4cc9f0);
    border-radius: 15px 15px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 4px;
}

.bar:hover {
    filter: brightness(1.2);
    transform: scaleX(1.1);
}

.bar-tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.bar-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent;
}

.bar:hover .bar-tooltip {
    opacity: 1;
}

.bar-label {
    font-size: 11px;
    color: var(--gray-color);
    font-weight: 500;
}

/* Estadísticas del gráfico - CORREGIDO */
.chart-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    gap: 10px;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--gray-color);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-color);
}

.stat-value.highlight {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
    padding: 2px 6px;
    border-radius: 12px;
    display: inline-block;
}

.stat-value.positive {
    color: #10b981;
}

/* Donut Chart - CORREGIDO */
.donut-chart {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) 0deg 162deg,
        var(--success-color) 162deg 270deg,
        var(--warning-color) 270deg 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-chart::before {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    z-index: 1;
}

.donut-labels {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.donut-label {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: var(--dark-color);
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.donut-label:nth-child(1) {
    top: 20%;
    left: 60%;
}

.donut-label:nth-child(2) {
    top: 60%;
    left: 60%;
}

.donut-label:nth-child(3) {
    top: 40%;
    left: 20%;
}

/* Badges */
.trend-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 8px;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.data-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-card-header h3 {
    font-size: 16px;
    color: var(--dark-color);
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.view-all:hover {
    gap: 8px;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 12px;
    font-size: 12px;
    color: var(--gray-color);
    font-weight: 500;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.status {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status.processing {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

/* Products List */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.product-item:last-child {
    border-bottom: none;
}

.product-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-info img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.product-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.product-info p {
    font-size: 11px;
    color: var(--gray-color);
}

.product-revenue {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.activity-icon.user {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.activity-icon.sale {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.activity-icon.message {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.activity-details p {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.activity-details small {
    font-size: 11px;
    color: var(--gray-color);
}

/* Calendar Mini */
.calendar-mini {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.event-item {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.event-item:last-child {
    border-bottom: none;
}

.event-date {
    text-align: center;
    min-width: 45px;
}

.event-date .day {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.2;
}

.event-date .month {
    font-size: 10px;
    color: var(--gray-color);
    text-transform: uppercase;
}

.event-details h4 {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.event-details p {
    font-size: 11px;
    color: var(--gray-color);
}

/* Footer */
.dashboard-footer {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--gray-color);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--gray-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Animations */
@keyframes bar-rise {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        height: var(--height);
        opacity: 1;
    }
}

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

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

.kpi-card,
.chart-card,
.data-card {
    animation: slideIn 0.5s ease forwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .menu-btn {
        display: block;
    }
    
    .search-box {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 20px;
    }
    
    .welcome-banner {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .search-box {
        display: none;
    }
    
    .dashboard-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .bar-item {
        width: 35px;
    }
    
    .bar-wrapper {
        width: 22px;
        height: 150px;
    }
    
    .bar-label {
        font-size: 10px;
    }
    
    .chart-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .donut-chart {
        width: 160px;
        height: 160px;
    }
    
    .donut-chart::before {
        width: 100px;
        height: 100px;
    }
}