/* Modern Analytics Dashboard - Sidebar Layout */

/* CSS Variables for Theme Support */
:root {
    /* Light Mode Colors */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --sidebar-width: 320px;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --secondary: #a78bfa;
    --accent: #f093fb;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 100vw;
    box-sizing: border-box;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-wrapper i {
    font-size: 24px;
}

.logo-wrapper h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.section-title i {
    font-size: 14px;
}

.search-wrapper {
    margin-bottom: 12px;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 14px;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Table Search Styles */
.table-search-wrapper {
    width: 100%;
}

.table-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.property-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.property-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.property-card-small {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.property-name-display {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.property-id-display {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-indicator.success {
    background: rgba(72, 187, 120, 0.1);
    color: #48bb78;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    padding: 12px 16px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-item {
    padding: 12px 16px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
}

.settings-item:hover {
    background: var(--bg-secondary);
}

.language-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    /* Prevent horizontal overflow */
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
    box-sizing: border-box;
    min-width: 0;
}

.main-content.expanded {
    margin-left: 0;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Ensure content doesn't exceed viewport */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-group h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-group h2 i {
    color: var(--primary);
}

.date-range-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.monthly-view-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.view-button {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--text-primary);
}

.view-button.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

.view-button i {
    font-size: 14px;
}

.monthly-view-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 24px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* KPI Toolbar */
.kpi-toolbar {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kpi-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.kpi-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kpi-search {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
}

.kpi-search:focus {
    outline: none;
    border-color: var(--primary);
}

.kpi-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.kpi-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kpi-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kpi-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.kpi-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.metric-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.data-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow-x: hidden;
    overflow-y: visible;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    /* Ensure card doesn't exceed viewport */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    /* Ensure card content stays within bounds */
    contain: layout;
}

.data-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
    /* Ensure card body doesn't cause overflow */
    overflow-x: hidden;
    overflow-y: visible;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    /* Strict constraint */
    min-width: 0;
}

/* Ensure table wrapper stays within card body */
.card-body > .table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    box-sizing: border-box;
    /* Add scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) var(--bg-tertiary);
}

/* Scrollbar styling for table wrapper */
.card-body > .table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.card-body > .table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.card-body > .table-wrapper::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

.card-body > .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Ensure pagination can scroll within card body on small screens */
.card-body [id$="-pagination"] {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Scrollable table container */
.table-scroll-container {
    width: 100%;
    max-width: 100%;
    height: 600px;
    max-height: 80vh;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    overflow: auto;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    box-sizing: border-box;
    /* Ensure container doesn't exceed parent width */
    min-width: 0;
    /* Prevent container from expanding beyond viewport */
    contain: layout;
    /* Strict width constraint - never exceed parent */
    width: calc(100% - 0px);
    max-width: calc(100% - 0px);
}

.table-scroll-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 6px;
    border: 2px solid var(--bg-tertiary);
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.table-scroll-container::-webkit-scrollbar-corner {
    background: var(--bg-tertiary);
}

.table-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    overflow-x: auto;
    overflow-y: visible;
    box-sizing: border-box;
    /* Ensure wrapper respects parent container */
    contain: layout;
}

/* For Geographic and Technology tables specifically - ensure they stay contained */
.card-body > .table-wrapper:has(#daily-geographic),
.card-body > .table-wrapper:has(#daily-technology),
.card-body > .table-wrapper:has(#weekly-geographic),
.card-body > .table-wrapper:has(#weekly-technology),
.card-body > .table-wrapper:has(#monthly-geographic),
.card-body > .table-wrapper:has(#monthly-technology),
.card-body > .table-wrapper:has(#custom-geographic),
.card-body > .table-wrapper:has(#custom-technology) {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* Fallback for browsers that don't support :has() */
.card-body > .table-wrapper[id*="geographic"],
.card-body > .table-wrapper[id*="technology"] {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.data-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
    display: table;
    /* Table can expand but wrapper will handle scrolling */
    max-width: none;
}

/* Ensure Geographic and Technology tables respect container */
.card-body .table-wrapper .data-table {
    width: auto;
    min-width: 100%;
    /* Table can be wider than container, but wrapper handles overflow */
}

.data-table thead {
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    min-width: 120px;
    width: auto;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

/* Sticky first column for horizontal scrolling */
.data-table th:first-child,
.data-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-tertiary);
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

/* Ensure sticky header first column has highest z-index (intersection of sticky header and sticky column) */
.data-table thead th:first-child {
    background: var(--bg-tertiary);
    z-index: 21;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Custom Range Card */
.custom-range-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.info-banner {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.info-banner i {
    color: var(--primary);
    margin-top: 2px;
}

.info-banner span {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.date-range-picker {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.date-input-group {
    flex: 1;
    min-width: 150px;
}

.date-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.date-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    padding-bottom: 6px;
}

.selected-range-display {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-content p {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.progress-container {
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
}

.progress-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination Styles */
#daily-geographic-pagination,
#daily-technology-pagination,
#weekly-geographic-pagination,
#weekly-technology-pagination,
#monthly-geographic-pagination,
#monthly-technology-pagination,
#custom-geographic-pagination,
#custom-technology-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) var(--bg-tertiary);
}

/* Pagination scrollbar styling for all screen sizes */
#daily-geographic-pagination::-webkit-scrollbar,
#daily-technology-pagination::-webkit-scrollbar,
#weekly-geographic-pagination::-webkit-scrollbar,
#weekly-technology-pagination::-webkit-scrollbar,
#monthly-geographic-pagination::-webkit-scrollbar,
#monthly-technology-pagination::-webkit-scrollbar,
#custom-geographic-pagination::-webkit-scrollbar,
#custom-technology-pagination::-webkit-scrollbar {
    height: 8px;
}

#daily-geographic-pagination::-webkit-scrollbar-track,
#daily-technology-pagination::-webkit-scrollbar-track,
#weekly-geographic-pagination::-webkit-scrollbar-track,
#weekly-technology-pagination::-webkit-scrollbar-track,
#monthly-geographic-pagination::-webkit-scrollbar-track,
#monthly-technology-pagination::-webkit-scrollbar-track,
#custom-geographic-pagination::-webkit-scrollbar-track,
#custom-technology-pagination::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

#daily-geographic-pagination::-webkit-scrollbar-thumb,
#daily-technology-pagination::-webkit-scrollbar-thumb,
#weekly-geographic-pagination::-webkit-scrollbar-thumb,
#weekly-technology-pagination::-webkit-scrollbar-thumb,
#monthly-geographic-pagination::-webkit-scrollbar-thumb,
#monthly-technology-pagination::-webkit-scrollbar-thumb,
#custom-geographic-pagination::-webkit-scrollbar-thumb,
#custom-technology-pagination::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

#daily-geographic-pagination::-webkit-scrollbar-thumb:hover,
#daily-technology-pagination::-webkit-scrollbar-thumb:hover,
#weekly-geographic-pagination::-webkit-scrollbar-thumb:hover,
#weekly-technology-pagination::-webkit-scrollbar-thumb:hover,
#monthly-geographic-pagination::-webkit-scrollbar-thumb:hover,
#monthly-technology-pagination::-webkit-scrollbar-thumb:hover,
#custom-geographic-pagination::-webkit-scrollbar-thumb:hover,
#custom-technology-pagination::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Pagination button groups */
#daily-geographic-pagination > div,
#daily-technology-pagination > div,
#weekly-geographic-pagination > div,
#weekly-technology-pagination > div,
#monthly-geographic-pagination > div,
#monthly-technology-pagination > div,
#custom-geographic-pagination > div,
#custom-technology-pagination > div {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

/* Pagination center text - allow shrinking on small screens */
#daily-geographic-pagination > div:nth-child(2),
#daily-technology-pagination > div:nth-child(2),
#weekly-geographic-pagination > div:nth-child(2),
#weekly-technology-pagination > div:nth-child(2),
#monthly-geographic-pagination > div:nth-child(2),
#monthly-technology-pagination > div:nth-child(2),
#custom-geographic-pagination > div:nth-child(2),
#custom-technology-pagination > div:nth-child(2) {
    flex: 1 1 auto;
    min-width: 120px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.collapsed {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Pagination center text on mobile - smaller min-width */
    #daily-geographic-pagination > div:nth-child(2),
    #daily-technology-pagination > div:nth-child(2),
    #weekly-geographic-pagination > div:nth-child(2),
    #weekly-technology-pagination > div:nth-child(2),
    #monthly-geographic-pagination > div:nth-child(2),
    #monthly-technology-pagination > div:nth-child(2),
    #custom-geographic-pagination > div:nth-child(2),
    #custom-technology-pagination > div:nth-child(2) {
        min-width: 100px;
        font-size: 0.85rem;
    }
    
    /* Smaller scrollbar on mobile */
    #daily-geographic-pagination::-webkit-scrollbar,
    #daily-technology-pagination::-webkit-scrollbar,
    #weekly-geographic-pagination::-webkit-scrollbar,
    #weekly-technology-pagination::-webkit-scrollbar,
    #monthly-geographic-pagination::-webkit-scrollbar,
    #monthly-technology-pagination::-webkit-scrollbar,
    #custom-geographic-pagination::-webkit-scrollbar,
    #custom-technology-pagination::-webkit-scrollbar {
        height: 6px;
    }
    
    .monthly-view-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .view-button {
        flex: 1;
    }
    
    .table-scroll-container {
        width: 100%;
        max-width: 100vw;
        margin-left: -20px;
        margin-right: -20px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    
    .date-range-picker {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input-group {
        width: 100%;
    }
    
    .date-separator {
        transform: rotate(90deg);
        padding: 0;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .kpi-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .kpi-filters {
        width: 100%;
    }
    
    .kpi-search {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 16px;
    }
    
    .page-title-group h2 {
        font-size: 24px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
