/* AnalyticsPro - SaaS Dashboard */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #c7d2fe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --dark: #111827;
    --gray-900: #1f2937;
    --gray-800: #374151;
    --gray-700: #4b5563;
    --gray-600: #6b7280;
    --gray-500: #9ca3af;
    --gray-400: #d1d5db;
    --gray-300: #e5e7eb;
    --gray-200: #f3f4f6;
    --gray-100: #f9fafb;
    --gray-50: #f8fafc;
    --white: #ffffff;
    
    /* Typography */
    --font-sans: 'Inter', sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 72px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    color: var(--gray-800);
    background-color: var(--gray-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

ul {
    list-style: none;
}

/* Back to Portfolio Button */
.back-to-portfolio {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--primary);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-fast);
}

.back-to-portfolio:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    overflow-x: hidden;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
}

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

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    gap: 0.5rem;
}

.logo i {
    font-size: 1.5rem;
}

.sidebar-toggle {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background-color: var(--gray-100);
    color: var(--gray-700);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    gap: 1rem;
}

.nav-item a:hover {
    color: var(--primary);
    background-color: var(--gray-50);
}

.nav-item.active a {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-item i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
}

.nav-item.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu li a {
    padding: 0.625rem 1.5rem 0.625rem 3.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-info div {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.logout-btn {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background-color: var(--gray-100);
    color: var(--danger);
}

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

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

/* Header */
.header {
    padding: 1.5rem 2rem;
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.header-left p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.search-bar input {
    height: 2.5rem;
    width: 240px;
    padding: 0 1rem 0 2.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
    width: 280px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
    position: relative;
}

.btn-icon:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    background-color: var(--gray-50);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background-color: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    height: 2.5rem;
    padding: 0 1.25rem;
    background-color: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

/* Card Styles */
.card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: all var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.time-select {
    height: 2rem;
    padding: 0 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-700);
    background-color: var(--white);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-select:focus {
    outline: none;
    border-color: var(--primary);
}

.view-all {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.view-all:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

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

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.bg-primary {
    background-color: var(--primary);
}

.bg-success {
    background-color: var(--success);
}

.bg-warning {
    background-color: var(--warning);
}

.bg-danger {
    background-color: var(--danger);
}

.bg-primary-light {
    background-color: var(--primary-light);
    color: var(--primary-dark) !important;
}

.bg-success-light {
    background-color: var(--success-light);
    color: var(--success) !important;
}

.bg-warning-light {
    background-color: var(--warning-light);
    color: var(--warning) !important;
}

.bg-danger-light {
    background-color: var(--danger-light);
    color: var(--danger) !important;
}

.stat-details h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    padding-bottom: 1.5rem;
}

.chart-container {
    height: 300px;
    padding: 1.5rem;
}

/* Recent Activity */
.recent-activity {
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.customer-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.customer-cell img {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.completed {
    background-color: var(--success-light);
    color: var(--success);
}

.status-badge.pending {
    background-color: var(--warning-light);
    color: var(--warning);
}

.status-badge.processing {
    background-color: var(--primary-light);
    color: var(--primary);
}

.status-badge.cancelled {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* Two Columns Section */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Activity Card */
.activity-card {
    height: 100%;
}

.activity-list {
    padding: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.activity-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
}

.activity-details p {
    margin-bottom: 0.25rem;
}

.activity-text {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.activity-time {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* Top Products */
.top-products {
    padding: 1rem;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.product-rank {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-full);
    background-color: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
}

.product-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.product-info p {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.product-sales {
    text-align: right;
    min-width: 100px;
}

.sales-amount {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 4px;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--primary);
    border-radius: var(--radius-full);
}

/* Responsive Styles */
@media (max-width: 1400px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar-header .logo span,
    .nav-item a span,
    .submenu,
    .user-info div {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
    
    .sidebar.expanded {
        width: var(--sidebar-width);
        z-index: 100;
    }
    
    .sidebar.expanded .sidebar-header .logo span,
    .sidebar.expanded .nav-item a span,
    .sidebar.expanded .submenu,
    .sidebar.expanded .user-info div {
        display: block;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 90;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 1rem 1.5rem;
    }
    
    .header-left {
        margin-bottom: 1rem;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .back-to-portfolio {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .chart-container {
        height: 250px;
    }
}