

/* ========================================
   ページ内タブ切り替え
======================================== */
.page-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
    margin: 1rem;
}

.dark .page-tabs {
    background-color: #1f2937;
}

.page-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    color: #617589;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .page-tab {
    color: #9ca3af;
}

.page-tab .material-symbols-outlined {
    font-size: 1.25rem;
}

.page-tab:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.dark .page-tab:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.page-tab.active {
    background-color: #ffffff;
    color: #137fec;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark .page-tab.active {
    background-color: #374151;
    color: #60a5fa;
}

/* タブコンテンツ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   メインコンテナ
======================================== */
body {
    min-height: 100vh;
    background-color: #f6f6f8;
}

.dark body {
    background-color: #101122;
}

.main-content {
    max-width: 26.875rem;
    margin: 0 auto;
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding-bottom: 5rem;
}

.dark .main-content {
    background-color: #101122;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* ========================================
   ガイドパネル
======================================== */
.guide-panel {
    padding: 1rem;
}

.guide-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #dbeafe;
    background-color: #eef2ff;
}

.dark .guide-panel-inner {
    border-color: #137fec;
    background-color: rgba(19, 127, 236, 0.1);
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guide-icon {
    font-size: 1.25rem;
    color: #137fec;
}

.guide-title {
    color: #111418;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.dark .guide-title {
    color: #ffffff;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

.guide-steps li {
    display: flex;
    gap: 0.5rem;
    color: #617589;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
}

.dark .guide-steps li {
    color: #d1d5db;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    background-color: #137fec;
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 9999px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.step-text {
    flex: 1;
}

.guide-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #137fec;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
}

.guide-link:hover {
    text-decoration: underline;
}

.guide-link .material-symbols-outlined {
    font-size: 0.875rem;
}

/* ========================================
   アップロードエリア
======================================== */
.upload-area {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.upload-area-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3.5rem 1.5rem;
    border-radius: 0.75rem;
    border-width: 2px;
    border-style: dashed;
    border-color: #cbd5e1;
    background-color: rgba(238, 242, 255, 0.3);
}

.dark .upload-area-inner {
    border-color: #374151;
    background-color: rgba(255, 255, 255, 0.05);
}

.upload-icon-wrapper {
    padding: 1rem;
    background-color: rgba(19, 127, 236, 0.1);
    border-radius: 9999px;
}

.upload-icon {
    font-size: 2.25rem;
    color: #137fec;
}

.upload-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 30rem;
}

.upload-title {
    color: #111418;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    letter-spacing: -0.015em;
}

.dark .upload-title {
    color: #ffffff;
}

.upload-subtitle {
    color: #617589;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
}

.dark .upload-subtitle {
    color: #9ca3af;
}

.upload-button {
    display: flex;
    min-width: 8.75rem;
    align-items: center;
    justify-content: center;
    height: 3rem;
    padding: 0 1.5rem;
    background-color: #137fec;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.015em;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(19, 127, 236, 0.4);
    transition: background-color 0.2s;
}

.upload-button:hover {
    background-color: rgba(19, 127, 236, 0.9);
}

/* ========================================
   進捗セクション
======================================== */
.progress-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.progress-header {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: flex-end;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.progress-title {
    color: #111418;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.dark .progress-title {
    color: #ffffff;
}

.progress-subtitle {
    color: #617589;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
}

.dark .progress-subtitle {
    color: #9ca3af;
}

.progress-percentage {
    color: #137fec;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.5;
}

.progress-bar-wrapper {
    width: 100%;
    height: 0.625rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    overflow: hidden;
}

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

.progress-bar {
    height: 100%;
    background-color: #137fec;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* ========================================
   履歴セクション
======================================== */
.history-section {
    margin-top: 1rem;
}

.history-title {
    color: #111418;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    padding: 1rem;
    padding-bottom: 0.5rem;
    padding-top: 1rem;
}

.dark .history-title {
    color: #ffffff;
}

.history-list {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f3f4f6;
}

.dark .history-list {
    border-bottom-color: #1f2937;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.dark .history-item {
    border-bottom-color: #1f2937;
}

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

.history-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.history-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.history-icon-wrapper.success {
    background-color: #f0fdf4;
}

.dark .history-icon-wrapper.success {
    background-color: rgba(16, 185, 129, 0.1);
}

.history-icon-wrapper.success .material-symbols-outlined {
    color: #16a34a;
}

.dark .history-icon-wrapper.success .material-symbols-outlined {
    color: #4ade80;
}

.history-icon-wrapper.neutral {
    background-color: #f9fafb;
}

.dark .history-icon-wrapper.neutral {
    background-color: #1f2937;
}

.history-icon-wrapper.neutral .material-symbols-outlined {
    color: #9ca3af;
}

.history-icon-wrapper .material-symbols-outlined {
    font-size: 1.25rem;
}

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

.history-filename {
    color: #111418;
    font-size: 0.875rem;
    font-weight: 700;
}

.dark .history-filename {
    color: #ffffff;
}

.history-date {
    color: #617589;
    font-size: 0.75rem;
}

.dark .history-date {
    color: #9ca3af;
}

.history-item-right {
    text-align: right;
}

.history-count {
    font-size: 0.875rem;
    font-weight: 700;
}

.history-count.success {
    color: #16a34a;
}

.dark .history-count.success {
    color: #4ade80;
}

.history-count.neutral {
    color: #4b5563;
}

.dark .history-count.neutral {
    color: #9ca3af;
}

/* ========================================
   レスポンシブ調整
======================================== */
@media (max-width: 640px) {
    .main-content {
        max-width: 100%;
        border-radius: 0;
    }
}

/* ========================================
   行動タグタブスタイル
======================================== */

/* カレンダーセクション */
.calendar-section {
    background-color: #ffffff;
    margin-top: 0.5rem;
    padding: 1rem;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .calendar-section {
    background-color: #111827;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.calendar-nav-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    color: #1366ec;
}

.calendar-month {
    font-size: 1rem;
    font-weight: 700;
    color: #111418;
}

.dark .calendar-month {
    color: #ffffff;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #9ca3af;
    padding: 0.5rem 0;
}

.calendar-day {
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #111418;
    position: relative;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}

.calendar-day:not(.empty):hover {
    background-color: #f3f4f6;
}

.dark .calendar-day {
    color: #ffffff;
}

.dark .calendar-day:not(.empty):hover {
    background-color: #1f2937;
}

.calendar-day.offset-4 {
    grid-column-start: 4;
}

.calendar-day-dot {
    position: absolute;
    bottom: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background-color: #3b82f6;
    border-radius: 9999px;
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
}

/* 睡眠データのみ: 青 */
.calendar-day-dot.sleep-only {
    background-color: #3b82f6;
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
}

/* タグのみ: 緑 */
.calendar-day-dot.tag-only {
    background-color: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

/* 両方: 2色ドット */
.calendar-day-dot.both {
    width: 1rem;
    height: 0.5rem;
    border-radius: 0.25rem;
    background: linear-gradient(90deg, #3b82f6 50%, #10b981 50%);
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.3), 0 0 4px rgba(16, 185, 129, 0.3);
}

/* カレンダー凡例 */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    opacity: 0.6;
}

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

.calendar-legend-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.calendar-legend-dot.sleep-only {
    background-color: #3b82f6;
}

.calendar-legend-dot.tag-only {
    background-color: #10b981;
}

.calendar-legend-dot.both {
    width: 0.75rem;
    border-radius: 0.125rem;
    background: linear-gradient(90deg, #3b82f6 50%, #10b981 50%);
}

.calendar-legend-label {
    font-size: 0.625rem;
    color: #9ca3af;
    font-weight: 400;
}

.calendar-day-selected {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #1366ec;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
}

/* ========================================
   タグセクション共通
======================================== */
.tag-section-title {
    color: #111418;
    font-size: 1.125rem;
    font-weight: 700;
    padding: 1rem 1rem 0.5rem 1rem;
}

.dark .tag-section-title {
    color: #ffffff;
}

.tag-section-title:first-of-type {
    padding-top: 1.5rem;
}

.tag-list {
    margin: 0 1rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
}

.dark .tag-list {
    background-color: #111827;
    border-color: #1f2937;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #f9fafb;
    cursor: pointer;
    gap: 0.75rem;
}

.dark .tag-item {
    border-bottom-color: #1f2937;
}

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

.tag-item:active {
    background-color: #f9fafb;
}

.dark .tag-item:active {
    background-color: #1f2937;
}

.tag-item-label {
    color: #111418;
    font-size: 1rem;
    font-weight: 500;
}

.dark .tag-item-label {
    color: #ffffff;
}

/* チェックボックス */
.tag-checkbox {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.25rem;
    border: 2px solid #d1d5db;
    background-color: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
}

.dark .tag-checkbox {
    border-color: #374151;
}

.tag-checkbox:checked {
    background-color: #1366ec;
    border-color: #1366ec;
}

.tag-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 0.375rem;
    height: 0.625rem;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
}

.tag-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(19, 102, 236, 0.3);
}

/* ========================================
   天気セクション
======================================== */
.weather-section {
    margin: 0 1rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    padding: 0.25rem;
    display: flex;
    gap: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
}

.dark .weather-section {
    background-color: #111827;
    border-color: #1f2937;
}

.weather-option {
    flex: 1;
}

.weather-option input {
    display: none;
}

.weather-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.weather-option-content:hover {
    background-color: #f3f4f6;
}

.dark .weather-option-content:hover {
    background-color: #1f2937;
}

.weather-option input:checked + .weather-option-content {
    background-color: #1366ec;
    color: #ffffff;
}

.weather-option-content .material-symbols-outlined {
    margin-bottom: 0.25rem;
}

.weather-option-content span:last-child {
    font-size: 0.75rem;
    font-weight: 700;
}

/* ========================================
   メモセクション
======================================== */
.notes-section {
    padding: 1rem;
}

.notes-section .tag-section-title {
    padding: 0.5rem 0;
}

.notes-textarea {
    width: 100%;
    height: 8rem;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    color: #111418;
}

.dark .notes-textarea {
    background-color: #111827;
    border-color: #1f2937;
    color: #ffffff;
}

.notes-textarea:focus {
    border-color: #1366ec;
    box-shadow: 0 0 0 2px rgba(19, 102, 236, 0.2);
}

.notes-textarea::placeholder {
    color: #9ca3af;
}

/* ========================================
   下部アクションボタン
======================================== */
.bottom-action {
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e5e7eb;
}

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

.save-button {
    width: 100%;
    background-color: #1366ec;
    color: #ffffff;
    font-weight: 700;
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(19, 102, 236, 0.2);
    transition: background-color 0.2s ease;
}

.save-button:hover {
    background-color: #1d4ed8;
}

.save-button:active {
    background-color: #1e40af;
}

/* ========================================
   インポート結果表示
======================================== */
.import-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    margin: 1rem;
    border-radius: 0.75rem;
    background-color: #f9fafb;
    text-align: center;
}

.dark .import-result {
    background-color: #111827;
}

.result-icon-wrapper {
    padding: 1rem;
    background-color: rgba(16, 185, 129, 0.1);
    border-radius: 9999px;
}

.result-icon {
    font-size: 3rem;
    color: #10b981;
}

.result-title {
    color: #111418;
    font-size: 1.25rem;
    font-weight: 700;
}

.dark .result-title {
    color: #ffffff;
}

.result-message {
    color: #617589;
    font-size: 0.875rem;
    line-height: 1.5;
}

.dark .result-message {
    color: #9ca3af;
}

/* ドラッグオーバー状態 */
.upload-area.dragover .upload-area-inner {
    border-color: #137fec;
    background-color: rgba(19, 127, 236, 0.1);
}

.dark .upload-area.dragover .upload-area-inner {
    border-color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}