/* ==============================================================================
   File: style.css
   Location: c:/Users/Paul_/.gemini/antigravity/scratch/Fittness AI/public/style.css
   Purpose: Global styling for the Fitness AI Dashboard, featuring a premium
            dark glassmorphic design and responsive grids.
   Version: 1.00
   ============================================================================== */

:root {
    --bg-base: #06070b;
    --bg-canvas: #0c0e16;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.35);
    
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.3);
    
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.25);
    
    --accent-coral: #f43f5e;
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-highlight: rgba(255, 255, 255, 0.02);
    --glass-blur: blur(24px);
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
}

/* Base App Layout */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr 380px;
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
}

/* Glassmorphic Panels */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

/* Sidebar Styling */
.sidebar {
    background: rgba(6, 7, 11, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    box-shadow: 0 0 15px 0 var(--accent-purple-glow);
}

.logo-area h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 16px;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    position: relative;
}

.status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-icon.active {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px 2px var(--accent-emerald-glow);
}

.status-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.status-name {
    font-size: 13px;
    font-weight: 600;
}

.status-details {
    font-size: 11px;
    color: var(--text-secondary);
}

.auth-btn {
    font-size: 11px;
    color: #ffffff;
    background: var(--accent-blue);
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.auth-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.sync-action {
    margin-top: auto;
}

.btn {
    width: 100%;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
}

.btn-glowing {
    box-shadow: 0 4px 20px 0 var(--accent-purple-glow);
}

.btn-glowing:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px 0 rgba(139, 92, 246, 0.5);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.last-sync-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Spinner Animation */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    display: none;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
    margin-top: 20px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
}

.profile-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Dashboard Space */
.main-content {
    padding: 32px;
    overflow-y: auto;
    height: 100vh;
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Metrics Row */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

#card-steps::before { background: var(--accent-blue); }
#card-sleep::before { background: var(--accent-purple); }
#card-calories::before { background: var(--accent-emerald); }
#card-weight::before { background: var(--accent-coral); }

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

.metric-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-secondary);
}

.icon-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    opacity: 0.15;
    background-color: var(--text-primary);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.metric-value .unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Analytics Row */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-container.full-width {
    grid-column: span 2;
}

.chart-container h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
}

/* AI Coach Panel (Right side) */
.ai-coach-panel {
    background: rgba(12, 14, 22, 0.45);
    border-left: 1px solid var(--glass-border);
    border-radius: 0;
    box-shadow: none;
    height: 100%;
    display: grid;
    grid-template-rows: 72px 1fr auto;
}

.coach-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.coach-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-coral));
    box-shadow: 0 0 10px 0 rgba(139, 92, 246, 0.3);
}

.coach-details h3 {
    font-size: 14px;
    font-weight: 600;
}

.coach-status {
    font-size: 11px;
    color: var(--accent-emerald);
    display: flex;
    align-items: center;
    gap: 4px;
}

.coach-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
}

.chat-history {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Chat Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}

.system-msg {
    align-self: flex-start;
}

.system-msg .msg-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user-msg {
    align-self: flex-end;
}

.user-msg .msg-bubble {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: var(--transition-smooth);
}

#chat-input:focus {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(255, 255, 255, 0.04);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--accent-purple);
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
}

.send-btn:hover {
    background: #7c3aed;
    transform: scale(1.05);
}

.send-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 45%;
    width: 8px;
    height: 8px;
    border-top: 2px solid white;
    border-right: 2px solid white;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Responsive Rules */
@media(max-width: 1400px) {
    .app-container:not(.single-layout) {
        grid-template-columns: 240px 1fr;
        grid-template-rows: 1fr 400px;
    }
    .app-container.single-layout {
        grid-template-columns: 240px 1fr;
        grid-template-rows: 1fr;
    }
    
    .app-container:not(.single-layout) .sidebar {
        height: 100vh;
        grid-row: span 2;
    }
    .app-container.single-layout .sidebar {
        height: 100vh;
    }
    
    .app-container:not(.single-layout) .main-content {
        height: calc(100vh - 400px);
    }
    .app-container.single-layout .main-content {
        height: 100vh;
    }
    
    .ai-coach-panel {
        grid-column: 2;
        grid-row: 2;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        height: 400px;
    }
}

/* Aura Proactive Alerts Styling */
.aura-alerts-container {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.aura-alert {
    padding: 16px 20px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    animation: slideInDown 0.4s ease-out;
}

.aura-alert.info {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}

.aura-alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
}

.aura-alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.aura-alert-text {
    line-height: 1.5;
}

.aura-alert-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.aura-alert-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom styles for raw data capture layout */
.app-container.single-layout {
    grid-template-columns: 260px 1fr;
}
.capture-table th, .capture-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}
.capture-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge.active {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge.inactive {
    background: rgba(244, 63, 94, 0.08);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.15);
}

/* Interactive Hover Tooltips */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.tooltip-content {
    visibility: hidden;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-family: monospace;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}
.tooltip-container:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Tooltip Down class */
.tooltip-down .tooltip-content {
    top: 100%;
    bottom: auto;
    margin-top: 8px;
}
.tooltip-down .tooltip-content::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent rgba(15, 23, 42, 0.98) transparent;
}

/* Tooltip Up class */
.tooltip-up .tooltip-content {
    bottom: 100%;
    top: auto;
    margin-bottom: 8px;
}
.tooltip-up .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.98) transparent transparent transparent;
}

/* Custom Scrollbar for WebKit (Chrome, Safari, Edge, inside page body) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Firefox standard thin scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(15, 23, 42, 0.5);
}

/* Sync Alert Banner Styling */
.alert-banner {
    padding: 16px 20px;
    background: rgba(245, 158, 11, 0.08); /* Amber warning color */
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    animation: slideInDown 0.4s ease-out;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-message {
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
    flex: 1;
}

.alert-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.alert-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Sidebar Nav Links */
.nav-link:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
}

/* Tab Views */
.tab-view {
    display: none;
}
.tab-view.active {
    display: block;
}

/* File Explorer Styling */
.explorer-grid-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
    position: relative;
    user-select: none;
}

.explorer-grid-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.explorer-item-icon {
    font-size: 32px;
}

.explorer-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.explorer-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.context-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}
