/* FriendsGym Design System & Responsive Styles */

:root {
    --primary-hue: 221;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    
    --bg-body-dark: #0f172a;
    --bg-surface-dark: #1e293b;
    --bg-card-dark: #1e293b;
    --border-dark: rgba(255, 255, 255, 0.08);

    --bg-body-light: #f8fafc;
    --bg-surface-light: #ffffff;
    --bg-card-light: #ffffff;
    --border-light: rgba(0, 0, 0, 0.08);

    --sidebar-width: 260px;
    --bottom-nav-height: 68px;
    --top-nav-height: 64px;
}

[data-bs-theme="dark"] {
    --bg-body: var(--bg-body-dark);
    --bg-surface: var(--bg-surface-dark);
    --bg-card: var(--bg-card-dark);
    --border-color: var(--border-dark);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

[data-bs-theme="light"] {
    --bg-body: var(--bg-body-light);
    --bg-surface: var(--bg-surface-light);
    --bg-card: var(--bg-card-light);
    --border-color: var(--border-light);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
}

body.app-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Touch targets >= 48px on mobile */
button, .btn, .nav-link, select, input {
    touch-action: manipulation;
}

.btn {
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

/* Layout Architecture */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - var(--top-nav-height));
}

.top-navbar {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: var(--top-nav-height);
    z-index: 1030;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.12);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-subtitle {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Sidebar (Desktop) */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    display: none;
    position: sticky;
    top: var(--top-nav-height);
    height: calc(100vh - var(--top-nav-height));
    overflow-y: auto;
    z-index: 1020;
}

@media (min-width: 992px) {
    .app-sidebar {
        display: block;
    }
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
    color: #ffffff;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar-nav .nav-link .nav-icon {
    font-size: 1.15rem;
}

/* Main Content Area */
.app-main-content {
    flex-grow: 1;
    min-width: 0;
    background: var(--bg-body);
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

@media (min-width: 992px) {
    .app-main-content {
        padding-bottom: 40px;
    }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 1040;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.bottom-nav-container {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    width: 20%;
    height: 100%;
    transition: all 0.15s ease;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

/* Floating Center Camera Button */
.bottom-nav-center {
    position: relative;
    top: -12px;
}

.camera-fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.5);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-center:hover .camera-fab {
    transform: scale(1.08);
}

/* Cards & Widgets */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card.border-start-primary { border-left: 4px solid var(--primary-color) !important; }
.stat-card.border-start-success { border-left: 4px solid var(--success-color) !important; }
.stat-card.border-start-warning { border-left: 4px solid var(--warning-color) !important; }
.stat-card.border-start-info { border-left: 4px solid #06b6d4 !important; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.avatar-circle-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.avatar-circle-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: auto;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Camera & Face Recognition Styles */
.camera-card {
    border-radius: 20px;
}

.camera-viewport {
    position: relative;
    width: 100%;
    height: 380px;
    background: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .camera-viewport {
        height: 440px;
    }
}

.camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror camera for intuitive user experience */
}

/* Face Oval Frame Overlay */
.face-guide-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-oval {
    width: 220px;
    height: 280px;
    border: 3px dashed rgba(59, 130, 246, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #38bdf8, #60a5fa, transparent);
    box-shadow: 0 0 10px #38bdf8;
    animation: scanAnim 2.2s infinite ease-in-out;
}

@keyframes scanAnim {
    0% { top: 0%; opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.face-instruction {
    background: rgba(0, 0, 0, 0.65);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-danger  { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-secondary { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-dark { background: #0f172a; color: #ffffff; }

.hover-bg:hover {
    background: rgba(255, 255, 255, 0.04);
}

.quick-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
}
