/**
 * TestDriven Custom Styles
 * Custom styling for the TestDriven athletic performance tracking application
 * Built on top of Materio Bootstrap Admin Template
 */

/* ===== Brand Colors ===== */
:root {
    /* Override Materio's purple-tinted background with neutral grey */
    --bs-body-bg: #f5f5f5;
    
    /* Primary accent color - Athletic Coral/Orange for competitive energy */
    --app-accent: #FF6B4A;
    --app-accent-hover: #E55A3A;
    --app-accent-light: #FFE8E3;
    --app-accent-dark: #CC4428;
    
    /* Activity type colors */
    --activity-cycling: #ff6b6b;
    --activity-running: #4ecdc4;
    --activity-swimming: #45b7d1;
    --activity-hiking: #95a5a6;
    --activity-strength: #e67e22;
    
    /* Performance indicators */
    --perf-excellent: #27ae60;
    --perf-good: #2ecc71;
    --perf-average: #f39c12;
    --perf-below: #e74c3c;
    
    /* HR Zone colors */
    --hr-zone-1: #95a5a6;  /* Recovery */
    --hr-zone-2: #3498db;  /* Aerobic */
    --hr-zone-3: #f39c12;  /* Tempo */
    --hr-zone-4: #e67e22;  /* Threshold */
    --hr-zone-5: #e74c3c;  /* VO2 Max */
}

/* ===== Override Materio Primary with Accent ===== */
.btn-primary {
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--app-accent-hover) !important;
    border-color: var(--app-accent-hover) !important;
}

/* Outline primary buttons - subtle coral ghost style */
.btn-outline-primary {
    color: var(--app-accent) !important;
    border-color: transparent !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff !important;
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
}

.btn-outline-primary:active,
.btn-outline-primary.active {
    color: #fff !important;
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
}

.text-primary {
    color: var(--app-accent) !important;
}

a.text-primary:hover {
    color: var(--app-accent-hover) !important;
}

.bg-primary {
    background-color: var(--app-accent) !important;
}

.border-primary {
    border-color: var(--app-accent) !important;
}

.badge.bg-primary {
    background-color: var(--app-accent) !important;
}

/* ===== Activity Type Icons ===== */
.activity-icon.cycling { color: var(--activity-cycling); }
.activity-icon.running { color: var(--activity-running); }
.activity-icon.swimming { color: var(--activity-swimming); }
.activity-icon.hiking { color: var(--activity-hiking); }
.activity-icon.strength { color: var(--activity-strength); }

/* ===== Custom Card Styles ===== */
.card-stat {
    border-left: 4px solid var(--app-accent);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 212, 170, 0.15);
}

.card-activity {
    transition: all 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-activity:hover {
    border-color: var(--app-accent);
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.1);
}

/* Metric cards with icon */
.metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, var(--app-accent-light), #fff);
}

.metric-card .metric-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2c3e50;
}

.metric-card .metric-label {
    font-size: 0.875rem;
    color: #7f8c8d;
    font-weight: 500;
}

.metric-card .metric-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.metric-card .metric-change.positive {
    color: var(--perf-good);
}

.metric-card .metric-change.negative {
    color: var(--perf-below);
}

/* ===== Chart Containers ===== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ===== File Upload Zone ===== */
.file-upload-zone {
    border: 2px dashed #d9d9d9;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    transition: all 0.3s;
    background: #fafafa;
    cursor: pointer;
}

.file-upload-zone:hover {
    border-color: var(--app-accent);
    background: var(--app-accent-light);
}

.file-upload-zone.drag-over {
    border-color: var(--app-accent);
    background: var(--app-accent-light);
    border-width: 3px;
}

.file-upload-zone .upload-icon {
    font-size: 48px;
    color: var(--app-accent);
    margin-bottom: 16px;
}

.file-upload-zone .upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.file-upload-zone .upload-hint {
    font-size: 0.875rem;
    color: #7f8c8d;
}

/* Progress bar for uploads */
.upload-progress {
    margin-top: 16px;
    display: none;
}

.upload-progress.active {
    display: block;
}

.upload-progress .progress {
    height: 8px;
    border-radius: 4px;
    background: #ecf0f1;
}

.upload-progress .progress-bar {
    background: linear-gradient(90deg, var(--app-accent), var(--app-accent-hover));
    transition: width 0.3s;
}

/* ===== Activity Table Enhancements ===== */
.activity-row {
    transition: all 0.2s;
}

.activity-row:hover {
    background-color: rgba(0, 212, 170, 0.05);
}

.activity-type-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-type-badge.cycling {
    background: rgba(255, 107, 107, 0.1);
    color: var(--activity-cycling);
}

.activity-type-badge.running {
    background: rgba(78, 205, 196, 0.1);
    color: var(--activity-running);
}

.activity-type-badge.swimming {
    background: rgba(69, 183, 209, 0.1);
    color: var(--activity-swimming);
}

/* ===== HR Zone Indicators ===== */
.hr-zone-indicator {
    width: 8px;
    height: 100%;
    border-radius: 4px;
}

.hr-zone-1 { background-color: var(--hr-zone-1); }
.hr-zone-2 { background-color: var(--hr-zone-2); }
.hr-zone-3 { background-color: var(--hr-zone-3); }
.hr-zone-4 { background-color: var(--hr-zone-4); }
.hr-zone-5 { background-color: var(--hr-zone-5); }

/* HR Zone labels */
.hr-zone-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hr-zone-label .zone-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ===== VO2 Form Dynamic Rows ===== */
.vo2-row {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: background 0.2s;
}

.vo2-row:hover {
    background: #ecf0f1;
}

.vo2-row .btn-remove {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.vo2-row:hover .btn-remove {
    opacity: 1;
}

/* ===== Responsive Tables ===== */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem;
    }
    
    .metric-card .metric-value {
        font-size: 1.5rem;
    }
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state .empty-icon {
    font-size: 64px;
    color: #bdc3c7;
    margin-bottom: 16px;
}

.empty-state .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.empty-state .empty-description {
    font-size: 0.875rem;
    color: #7f8c8d;
    margin-bottom: 24px;
}

/* ===== Loading States ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 212, 170, 0.1);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Stat Comparison Arrows ===== */
.stat-arrow {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-arrow.up {
    color: var(--perf-good);
}

.stat-arrow.down {
    color: var(--perf-below);
}

/* ===== Custom Scrollbar for Activity Feed ===== */
.activity-feed {
    max-height: 500px;
    overflow-y: auto;
}

.activity-feed::-webkit-scrollbar {
    width: 6px;
}

.activity-feed::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--app-accent);
    border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb:hover {
    background: var(--app-accent-hover);
}

/* ===== Badge Enhancements ===== */
.badge.badge-activity {
    padding: 6px 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ===== Integration Status Indicators ===== */
.integration-card {
    position: relative;
    overflow: hidden;
}

.integration-card .status-indicator {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #95a5a6;
}

.integration-card .status-indicator.connected {
    background: var(--perf-good);
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.2);
}

.integration-card .status-indicator.disconnected {
    background: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.2);
}

/* ===== Utility Classes ===== */
.text-muted-light {
    color: #95a5a6 !important;
}

.border-accent {
    border-color: var(--app-accent) !important;
}

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

/* ===== Menu Active State Override ===== */
.menu .menu-item.active > .menu-link {
    background-color: var(--app-accent-light) !important;
    color: var(--app-accent) !important;
}

.menu .menu-item.active > .menu-link .menu-icon {
    color: var(--app-accent) !important;
}

/* ===== Print Styles ===== */
@media print {
    .layout-menu,
    .layout-navbar,
    .content-footer,
    .btn,
    .dropdown {
        display: none !important;
    }
    
    .layout-page {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ===== Settings Page Tab Styling ===== */
/* Add horizontal spacing between tab buttons on desktop */
@media (min-width: 768px) {
    .nav-pills .nav-item:not(:last-child) {
        margin-right: 0.5rem;
    }
}

/* ===== Full-Width Navbar ===== */
/* Override Materio's detached navbar to create full-width bar */
.layout-navbar {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Ensure navbar content stays within standard page width */
.layout-navbar .container-xxl {
    display: flex;
    align-items: center;
    width: 100%;
}

/* ===== Navbar Logo ===== */
.navbar-logo {
    height: 36px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.navbar-logo:hover {
    opacity: 0.85;
}

/* Responsive logo sizing */
@media (max-width: 991px) {
    .navbar-logo {
        height: 24px;
        max-width: 180px;
    }
}

@media (max-width: 768px) {
    .navbar-logo {
        height: 20px;
        max-width: 150px;
    }
}

@media (max-width: 576px) {
    .navbar-logo {
        height: 18px;
        max-width: 130px;
    }
}

/* ===== Dropdown Menu Icon Alignment ===== */
/* Fix vertical alignment of icons in dropdown items */
.dropdown-item i {
    vertical-align: middle;
}

/* ===== Page Header Icon Alignment ===== */
/* Fix vertical alignment of icons in page headers */
h4 i {
    vertical-align: middle;
}

/* ===== Remix Icon Size Utilities ===== */
/* Size classes for Remix Icons (.ri class) */
.ri-18px {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

.ri-22px {
    font-size: 22px !important;
    width: 22px !important;
    height: 22px !important;
}

.ri-24px {
    font-size: 24px !important;
    width: 24px !important;
    height: 24px !important;
}

.ri-28px {
    font-size: 28px !important;
    width: 28px !important;
    height: 28px !important;
}

.ri-32px {
    font-size: 32px !important;
    width: 32px !important;
    height: 32px !important;
}

.ri-36px {
    font-size: 36px !important;
    width: 36px !important;
    height: 36px !important;
}

.ri-48px {
    font-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
}

/* ===== Navbar Banner Styling ===== */
/* Make navbar touch top of page with banner rolling out from browser */
body {
    margin: 0 !important;
    padding: 0 !important;
}

.layout-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.layout-navbar {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.navbar-banner {
    height: 90px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Ensure navbar container touches top - remove padding */
.layout-navbar .container-xxl {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .navbar-banner {
        height: 80px;
    }
}

@media (max-width: 480px) {
    .navbar-banner {
        height: 70px;
    }
}
