/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: max(884px, 100dvh);
    background-color: #f6f7f8;
    color: #111418;
    padding-bottom: 24px;
}

body.dark {
    background-color: #101722;
    color: white;
}

/* Material Icons */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.active-tab {
    color: #1366ec;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e5e7eb;
}

body.dark header {
    background-color: rgba(16, 23, 34, 0.8);
    border-bottom-color: #1f2937;
}

.header-content {
    display: flex;
    align-items: center;
    padding: 16px;
    justify-content: space-between;
    max-width: 448px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.back-icon {
    font-size: 24px;
    cursor: pointer;
}

.search-icon {
    font-size: 24px;
}

/* Main Container */
main {
    max-width: 448px;
    margin: 0 auto;
}

/* Filter Section */
.filter-section {
    padding: 16px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-buttons {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.filter-button {
    display: flex;
    height: 36px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 8px;
    background-color: white;
    border: 1px solid #e5e7eb;
    padding: 0 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

body.dark .filter-button {
    background-color: #1f2937;
    border-color: #374151;
}

.filter-button span {
    font-size: 14px;
    font-weight: 500;
}

.filter-button .material-symbols-outlined {
    font-size: 14px;
}

/* Filter Dropdown */
.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    display: flex;
    height: 36px;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
    background-color: white;
    border: 1px solid #e5e7eb;
    padding: 0 32px 0 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    font-size: 14px;
    font-weight: 500;
    color: #111418;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

body.dark .filter-select {
    background-color: #1f2937;
    border-color: #374151;
    color: white;
}

.filter-select:focus {
    outline: none;
    border-color: #1366ec;
    box-shadow: 0 0 0 2px rgba(19, 102, 236, 0.1);
}

.filter-select option {
    padding: 8px;
}

.filter-icon {
    position: absolute;
    right: 8px;
    pointer-events: none;
    font-size: 18px;
    color: #9ca3af;
}

/* Tag Remove Button */
.tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

/* No Data Message */
.no-data {
    text-align: center;
    padding: 60px 20px;
    font-size: 14px;
    color: #9ca3af;
    font-weight: 500;
}

/* Grade Colors */
.grade-s { color: #22c55e; }
.grade-a { color: #1366ec; }
.grade-b { color: #6366f1; }
.grade-c { color: #f97316; }
.grade-d { color: #f59e0b; }
.grade-e { color: #ef4444; }

.grade-s span { color: rgba(34, 197, 94, 0.6); }
.grade-a span { color: rgba(19, 102, 236, 0.6); }
.grade-b span { color: rgba(99, 102, 241, 0.6); }
.grade-c span { color: rgba(249, 115, 22, 0.6); }
.grade-d span { color: rgba(245, 158, 11, 0.6); }
.grade-e span { color: rgba(239, 68, 68, 0.6); }

/* Progress Fill Grade Colors */
.progress-fill.grade-s { background-color: #22c55e; }
.progress-fill.grade-a { background-color: #1366ec; }
.progress-fill.grade-b { background-color: #6366f1; }
.progress-fill.grade-c { background-color: #f97316; }
.progress-fill.grade-d { background-color: #f59e0b; }
.progress-fill.grade-e { background-color: #ef4444; }

/* Tags Section */
.tags-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tags-container::-webkit-scrollbar {
    display: none;
}

.tags-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tag {
    display: flex;
    height: 32px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0 16px;
}

.tag.primary {
    background-color: rgba(19, 102, 236, 0.1);
    color: #1366ec;
    border: 1px solid rgba(19, 102, 236, 0.2);
}

.tag.gray {
    background-color: #f3f4f6;
    padding: 0 16px;
}

body.dark .tag.gray {
    background-color: #1f2937;
}

.tag p {
    font-size: 12px;
    font-weight: 700;
}

/* Stats Card */
.stats-section {
    padding: 0 16px;
}

.stats-card {
    background-color: #1366ec;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(19, 102, 236, 0.2);
}

body.dark .stats-card {
    background-color: rgba(19, 102, 236, 0.2);
    color: white;
}

.stats-item {
    display: flex;
    flex-direction: column;
}

.stats-item.center {
    align-items: center;
}

.stats-item.end {
    align-items: flex-end;
}

.stats-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    font-weight: 700;
    margin-bottom: 4px;
}

.stats-value {
    font-size: 20px;
    font-weight: 700;
}

.stats-value.large {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.stats-value span {
    font-size: 18px;
    font-weight: 500;
    margin-left: 2px;
}

.stats-divider {
    height: 40px;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Log Cards */
.logs-section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.log-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    overflow: hidden;
    transition: all 0.2s;
}

body.dark .log-card {
    background-color: #111827;
    border-color: #1f2937;
}

.log-card:active {
    transform: scale(0.98);
}

.log-card-content {
    padding: 20px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.log-date {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

body.dark .log-date {
    color: #6b7280;
}

.log-hours {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.075em;
}

.log-hours span {
    font-size: 18px;
    font-weight: 700;
    margin-left: 4px;
}

.log-hours.primary {
    color: #1366ec;
}

.log-hours.primary span {
    color: rgba(19, 102, 236, 0.6);
}

.log-hours.green {
    color: #22c55e;
}

.log-hours.green span {
    color: rgba(34, 197, 94, 0.6);
}

.log-hours.orange {
    color: #f97316;
}

.log-hours.orange span {
    color: rgba(249, 115, 22, 0.6);
}

.log-score-label {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
}

.log-score-value {
    font-size: 18px;
    font-weight: 700;
    color: #374151;
}

body.dark .log-score-value {
    color: #d1d5db;
}

/* Progress Section */
.progress-section {
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 6px;
}

.progress-label {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
}

.progress-value {
    font-size: 10px;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    background-color: #f3f4f6;
    border-radius: 9999px;
    height: 10px;
}

body.dark .progress-bar {
    background-color: #1f2937;
}

.progress-fill {
    height: 10px;
    border-radius: 9999px;
}

.progress-fill.primary {
    background-color: #1366ec;
}

.progress-fill.green {
    background-color: #22c55e;
}

.progress-fill.orange {
    background-color: #f97316;
}

/* Time and Sleep Phases */
.time-section {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #f9fafb;
}

body.dark .time-section {
    border-bottom-color: #1f2937;
}

.time-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

.time-info .material-symbols-outlined {
    font-size: 18px;
}

.sleep-phases {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.sleep-phase {
    font-size: 11px;
    color: #9ca3af;
}

.sleep-phase span {
    font-weight: 700;
    color: #4b5563;
}

body.dark .sleep-phase span {
    color: #9ca3af;
}

/* Tags and Actions */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-tags {
    display: flex;
    gap: -4px;
    overflow: hidden;
}

.card-tag {
    padding: 4px 8px;
    background-color: #f9fafb;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    margin-left: 4px;
}

body.dark .card-tag {
    background-color: #1f2937;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    padding: 0 16px;
    height: 32px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.action-button.outline {
    border: 1px solid #e5e7eb;
    color: #4b5563;
    background: transparent;
}

body.dark .action-button.outline {
    border-color: #374151;
    color: #9ca3af;
}

.action-button.primary {
    background-color: #1366ec;
    color: white;
    border: none;
}

/* Tap Hint */
.tap-hint {
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Bottom Navigation */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-top: 1px solid #f3f4f6;
    padding-bottom: env(safe-area-inset-bottom);
}

body.dark nav {
    background-color: rgba(16, 23, 34, 0.9);
    border-top-color: #1f2937;
}

.nav-content {
    max-width: 448px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding: 12px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #9ca3af;
}

.nav-item.active {
    color: #1366ec;
}

.nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 700;
}