/* Shems Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --primary: #2563EB;
    /* Electric Royal Blue */
    --primary-dark: #1E40AF;
    --secondary: #10B981;
    /* Vibrant Emerald */
    --accent: #F59E0B;
    /* Amber/Orange */
    --danger: #EF4444;

    /* Neutrals */
    --bg-body: #F3F4F6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-light: #E5E7EB;

    /* Shadows & Glass */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);

    /* Animation */
    --anim-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --anim-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    padding-bottom: 80px;
    /* Space for efficient scrolling */
}

/* Header & Nav */
header {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
}

nav {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    cursor: pointer;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--anim-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--primary);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Layout */
main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 80vh;
}

.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hero Cards */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: transform var(--anim-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.stat-card.accent {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.stat-unit {
    font-size: 1rem;
    opacity: 0.8;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Insight Cards */
.insight-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.icon-box.info {
    background: #DBEAFE;
    color: var(--primary);
}

.icon-box.warn {
    background: #FEF3C7;
    color: var(--accent);
}

.icon-box.danger {
    background: #FEE2E2;
    color: var(--danger);
}

.insight-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.insight-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Device Lists */
.device-card {
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--anim-fast);
}

.device-card:hover {
    box-shadow: var(--shadow-md);
}

.device-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.device-info strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.device-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Toggles (Apple Style) */
.switch {
    display: inline-block;
    position: relative;
    width: 50px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5E7EB;
    border-radius: 34px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Charts */
.chart-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

/* Chart Header & Legend */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.dot.used {
    background: var(--secondary);
}

.dot.predicted {
    background: #E5E7EB;
    /* Optional: striped pattern for legend dot if desired, but solid grey is cleaner for small dots */
}

.bar-chart {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    height: 200px;
    padding-top: 1rem;
    position: relative;
}

/* Add a line for Today */
.today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 71%;
    /* Position between Fri and Sat roughly */
    width: 2px;
    background: var(--primary);
    border-radius: 2px;
    opacity: 0.1;
    pointer-events: none;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 1;
    height: 100%;
}

.bar {
    width: 24px;
    background: repeating-linear-gradient(45deg,
            #E5E7EB,
            #E5E7EB 4px,
            #F3F4F6 4px,
            #F3F4F6 8px);
    /* Striped grey for prediction */
    border-radius: 12px 12px 0 0;
    transition: height 0.5s var(--anim-bounce);
    position: relative;
}

/* Green for Used */
.bar.used {
    background: linear-gradient(to top, var(--secondary), #34D399);
}

.bar:hover::after {
    content: attr(data-val);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bar-day {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--anim-fast);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #F3F4F6;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #E5E7EB;
    transform: translateY(-1px);
}

.action-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Forms & Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--anim-fast);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.item-row:last-child {
    border-bottom: none;
}

/* Animations/Utilities */
@media (max-width: 640px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    nav {
        justify-content: space-between;
    }

    .nav-btn .label {
        display: none;
        /* Hide labels on mobile nav for cleanliness */
    }

    .nav-btn i {
        font-size: 1.25rem;
    }
}

/* Settings Specifics */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    text-align: center;
}

.avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    border: 4px solid white;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0 0 0;
}

.settings-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.settings-item {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
    cursor: pointer;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item:hover {
    background-color: #F9FAFB;
}

.settings-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1rem;
}

.settings-icon.blue {
    background: #DBEAFE;
    color: var(--primary);
}

.settings-icon.green {
    background: #D1FAE5;
    color: var(--secondary);
}

.settings-icon.purple {
    background: #EDE9FE;
    color: #8B5CF6;
}

.settings-icon.orange {
    background: #FFEDD5;
    color: #F97316;
}

.settings-icon.danger {
    background: #FEE2E2;
    color: var(--danger);
}

.settings-label {
    flex: 1;
    font-weight: 500;
    color: var(--text-main);
}

.settings-value {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.chevron {
    color: #9CA3AF;
    font-size: 0.8rem;
}

/* Custom progress for settings card */
.card-progress {
    padding: 0 1.25rem 1.25rem 1.25rem;
}

.card-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.card-progress-bar {
    background: #F3F4F6;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}