/* Apple Design System */
:root {
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #fafafa;
    --border: #d2d2d7;
    --border-light: #e8e8ed;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-brand .logo {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.06);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.04);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.user-avatar {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    background: var(--border-light);
}

/* Main Content */
.main-content {
    padding-top: 52px;
    min-height: 100vh;
}

.section {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    animation: fadeIn 0.5s ease-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 0 50px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1d1d1f 0%, #434344 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 21px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.blue {
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
}

.stat-icon.purple {
    background: rgba(175, 82, 222, 0.1);
    color: #af52de;
}

.stat-icon.orange {
    background: rgba(255, 149, 0, 0.1);
    color: #ff9500;
}

.stat-icon.green {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Chart Section */
.chart-section {
    margin-bottom: 40px;
}

.chart-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.chart-container {
    height: 300px;
    position: relative;
}

/* Recent Section */
.recent-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.link {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.link:hover {
    text-decoration: underline;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.recent-item:hover {
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.recent-route {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
}

.recent-sailor {
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

.recent-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select {
    padding: 12px 36px 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    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='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: var(--transition);
    outline: none;
}

.filter-group select:focus {
    border-color: var(--primary);
}

/* Table */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.data-table tbody tr:hover td {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td.message-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table td.message-cell:hover {
    white-space: normal;
    word-break: break-all;
}

.btn-action {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    background: rgba(0, 113, 227, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--primary);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stats Filter Bar */
.stats-filter-bar {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-dimension {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-dimension label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dimension-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dim-btn, .sub-dim-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.dim-btn:hover, .sub-dim-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.dim-btn.active, .sub-dim-btn.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.date-range {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-range input {
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
}

.date-range span {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-apply {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-apply:hover {
    background: var(--primary-hover);
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.overview-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.overview-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.overview-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.overview-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Stats Tabs */
.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    width: fit-content;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

/* Distribution Grid */
.dist-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 768px) {
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dist-grid {
        grid-template-columns: 1fr;
    }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Ranking List */
.ranking-list {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.ranking-item:hover {
    background: var(--bg-tertiary);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-rank {
    width: 36px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
}

.ranking-item:nth-child(1) .ranking-rank {
    color: #ffb800;
}

.ranking-item:nth-child(2) .ranking-rank {
    color: #a8a8a8;
}

.ranking-item:nth-child(3) .ranking-rank {
    color: #cd7f32;
}

.ranking-name {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ranking-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    padding: 6px 14px;
    background: rgba(0, 113, 227, 0.1);
    border-radius: 100px;
}

/* Import Section */
.import-card {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 28px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.02);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.05);
}

.upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-area p {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-area span {
    font-size: 13px;
    color: var(--text-secondary);
}

.import-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input {
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Progress Bar */
.import-progress {
    margin-top: 24px;
}

.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--bg-secondary);
}

.btn-close svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 60vh;
}

.detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    width: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

/* Responsive - Mobile Optimizations */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 768px) {
    /* Navbar mobile */
    .navbar {
        height: 48px;
    }
    
    .nav-container {
        padding: 0 16px;
    }
    
    .nav-brand span {
        font-size: 16px;
    }
    
    .nav-links {
        display: none;
    }
    
    /* Mobile navigation menu */
    .nav-links.mobile-active {
        display: flex;
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: saturate(180%) blur(20px);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        border-bottom: 1px solid var(--border-light);
        box-shadow: var(--shadow-md);
        z-index: 999;
    }
    
    .nav-links.mobile-active .nav-link {
        padding: 12px 16px;
        border-radius: var(--radius-md);
    }
    
    /* Main content mobile */
    .main-content {
        padding: 72px 16px 24px;
    }
    
    /* Hero section mobile */
    .hero {
        margin-bottom: 24px;
    }
    
    .hero-title {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* Chart section mobile */
    .chart-section {
        margin-bottom: 24px;
    }
    
    .chart-card {
        padding: 20px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    /* Recent section mobile */
    .recent-section {
        padding: 20px;
    }
    
    .recent-item {
        padding: 14px 0;
    }
    
    .recent-route {
        min-width: auto;
        font-size: 14px;
    }
    
    .recent-sailor {
        font-size: 13px;
    }
    
    /* Filter bar mobile */
    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select {
        flex: 1;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    /* Table mobile - card view */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        font-size: 13px;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .data-table th {
        font-size: 12px;
    }
    
    /* Pagination mobile */
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }
    
    .page-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 36px;
    }
    
    /* Stats filter bar mobile */
    .stats-filter-bar {
        padding: 16px;
        gap: 16px;
    }
    
    .dimension-tabs {
        flex-wrap: wrap;
    }
    
    .dim-btn, .sub-dim-btn {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 70px;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .date-range span {
        text-align: center;
    }
    
    .date-range input {
        width: 100%;
    }
    
    .btn-apply {
        width: 100%;
    }
    
    /* Stats overview mobile */
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .overview-card {
        padding: 16px;
    }
    
    .overview-value {
        font-size: 24px;
    }
    
    .overview-label {
        font-size: 12px;
    }
    
    /* Stats tabs mobile */
    .stats-tabs {
        width: 100%;
    }
    
    .tab-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Distribution grid mobile */
    .dist-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Ranking list mobile */
    .ranking-item {
        padding: 14px 16px;
    }
    
    .ranking-rank {
        width: 28px;
        font-size: 16px;
    }
    
    .ranking-name {
        font-size: 14px;
    }
    
    .ranking-count {
        font-size: 13px;
        padding: 4px 10px;
    }
    
    /* Import section mobile */
    .import-card {
        padding: 24px 20px;
    }
    
    .upload-area {
        padding: 32px 20px;
    }
    
    .upload-area svg {
        width: 40px;
        height: 40px;
    }
    
    .import-config {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Modal mobile */
    .modal-content {
        max-height: 90vh;
        margin: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 4px;
        padding: 10px 0;
    }
    
    .detail-label {
        width: auto;
        font-size: 12px;
    }
    
    .detail-value {
        font-size: 14px;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .hero-title {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .overview-value {
        font-size: 20px;
    }
    
    .dim-btn, .sub-dim-btn {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .stat-card:hover,
    .chart-card:hover,
    .ranking-item:hover,
    .recent-item:hover,
    .overview-card:hover {
        transform: none;
    }
    
    .data-table tbody tr:hover {
        transform: none;
    }
    
    /* Better touch targets */
    .btn-action,
    .page-btn,
    .nav-link,
    .tab-btn,
    .dim-btn,
    .sub-dim-btn {
        min-height: 44px;
    }
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Apple-style Navigation Dropdown (Mega Menu) */
.nav-dropdown {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    padding: 32px 0;
}

.nav-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 64px;
}

.dropdown-section {
    min-width: 200px;
}

.dropdown-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.dropdown-section a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px);
}

.nav-dropdown.active .dropdown-section a {
    opacity: 1;
    transform: translateY(0);
}

.nav-dropdown.active .dropdown-section a:nth-child(2) { transition-delay: 0.05s; }
.nav-dropdown.active .dropdown-section a:nth-child(3) { transition-delay: 0.1s; }
.nav-dropdown.active .dropdown-section a:nth-child(4) { transition-delay: 0.15s; }
.nav-dropdown.active .dropdown-section a:nth-child(5) { transition-delay: 0.2s; }

.dropdown-section a:hover {
    color: var(--primary);
    transform: translateX(8px);
}

.dropdown-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-section a:hover .dropdown-icon {
    background: rgba(0, 113, 227, 0.1);
    transform: scale(1.1);
}

/* Navigation link hover state for dropdown */
.nav-link[data-dropdown] {
    position: relative;
}

.nav-link[data-dropdown]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateX(-50%) scale(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link[data-dropdown]:hover::after,
.nav-link[data-dropdown].dropdown-active::after {
    transform: translateX(-50%) scale(1);
}

/* Mobile dropdown adjustments */
@media (max-width: 768px) {
    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        padding: 16px;
        background: var(--bg-tertiary);
        border-bottom: 1px solid var(--border-light);
    }
    
    .nav-dropdown.mobile-active {
        display: block;
    }
    
    .dropdown-content {
        flex-direction: column;
        gap: 24px;
        padding: 0;
    }
    
    .dropdown-section a {
        opacity: 1;
        transform: none;
    }
}

/* Apple-style Hover Animations */

/* Navigation hover effect */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Card hover effects - Apple style */
.stat-card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chart card hover */
.chart-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Recent item hover - slide effect */
.recent-item {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.recent-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.recent-item:hover {
    background: var(--bg-secondary);
    transform: translateX(8px);
    padding-left: 20px;
}

.recent-item:hover::before {
    transform: scaleY(1);
}

/* Table row hover */
.data-table tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-table tbody tr:hover {
    background: rgba(0, 113, 227, 0.04);
    transform: scale(1.01);
}

/* Button hover effects */
.btn-action, .page-btn, .dim-btn, .sub-dim-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.page-btn:not(:disabled):hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.page-btn.active:hover {
    background: var(--primary);
}

/* Ranking item hover */
.ranking-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.ranking-item:hover {
    background: var(--bg-secondary);
    transform: translateX(12px);
}

.ranking-item:hover .ranking-rank {
    transform: scale(1.2);
    color: var(--primary);
}

.ranking-rank {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab button hover */
.tab-btn {
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 113, 227, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.tab-btn:hover::before {
    width: 100%;
    height: 100%;
}

/* Upload area hover */
.upload-area {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.02);
    transform: scale(1.01);
}

.upload-area:hover svg {
    transform: translateY(-4px);
    color: var(--primary);
}

.upload-area svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Overview card hover */
.overview-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.overview-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.overview-card:hover .overview-value {
    transform: scale(1.1);
}

.overview-value {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Filter select hover */
.filter-group select:hover,
.search-box input:hover {
    border-color: var(--primary);
}

.filter-group select:focus,
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

/* Link hover animation */
.link {
    position: relative;
}

.link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link:hover::after {
    width: 100%;
}

/* Stagger animation for list items */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ranking-item,
.recent-item,
.data-table tbody tr {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.ranking-item:nth-child(1) { animation-delay: 0.05s; }
.ranking-item:nth-child(2) { animation-delay: 0.1s; }
.ranking-item:nth-child(3) { animation-delay: 0.15s; }
.ranking-item:nth-child(4) { animation-delay: 0.2s; }
.ranking-item:nth-child(5) { animation-delay: 0.25s; }

/* Error Message */
.error-message {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff3b30;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-width: 80%;
    text-align: center;
}

/* API Settings Button */
#apiSettingsBtn {
    cursor: pointer;
}

#apiSettingsBtn:hover {
    color: var(--primary);
}
