/**
 * DayRing スタイルシート
 * 24時間円グラフタスク管理アプリ
 */

/* ===================================
   CSS Variables (デザイントークン)
   =================================== */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2e2e2e;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #3a3a3a;
    --accent: #4a90a4;
    --sleep-color: #2c3e50;

    /* タスクカラーパレット（グレートーン寄り） */
    --color-1: #7a8b8c;
    --color-2: #a67c7c;
    --color-3: #7c8fa6;
    --color-4: #8ca67c;
    --color-5: #a6977c;
    --color-6: #7ca699;
    --color-7: #997ca6;
    --color-8: #a68c7c;
    --color-9: #7c99a6;
    --color-10: #a67c99;
    --color-11: #8b8b7a;
    --color-12: #7a7a8b;
}

/* ===================================
   リセット & ベース
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    margin-top: 20px;
    padding: 16px;
    padding-bottom: 100px;
}

/* ===================================
   ヘッダー
   =================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.date-display {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* ===================================
   起床時間設定
   =================================== */

.wake-sleep-time {
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.wake-time-section,
.sleep-time-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wake-time-label,
.sleep-time-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 20px;
}

.wake-time-input,
.sleep-time-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    width: 100px;
    text-align: center;
    color-scheme: dark;
    accent-color: var(--text-muted);
}

/* time inputの時計アイコンを非表示 */
.wake-time-input::-webkit-calendar-picker-indicator,
.sleep-time-input::-webkit-calendar-picker-indicator {
    display: none;
}

.wake-time-input:focus,
.sleep-time-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===================================
   円グラフ
   =================================== */
.circle-container {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 32px;
    aspect-ratio: 1;
}

.circle-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 24;
}

.circle-segment {
    fill: none;
    stroke-width: 24;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.circle-segment:hover {
    opacity: 0.8;
}

/* 中央の時計表示 */
.center-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.current-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.task-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 時間ラベル */
.time-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.time-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    transform: translate(-50%, -50%);
}

/* ===================================
   タスクリスト
   =================================== */
.task-list-section {
    margin-top: 24px;
}

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

.section-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    animation: fadeIn 0.3s ease forwards;
}

.task-item:hover {
    background: var(--bg-tertiary);
}

.task-item.active {
    border-color: var(--accent);
}

.task-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.task-extra {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===================================
   追加ボタン (FAB)
   =================================== */
.add-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74, 144, 164, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(74, 144, 164, 0.4);
}

.add-btn:active {
    transform: scale(0.95);
}

/* ===================================
   モーダル
   =================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

.modal-title {
    font-size: 16px;
    font-weight: 500;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-body {
    padding: 20px;
}

/* ===================================
   フォーム
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Noto Sans JP', sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.time-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.time-inputs .form-input {
    flex: 1;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.time-separator {
    color: var(--text-muted);
    font-size: 20px;
}

/* カラーピッカー */
.color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.color-option {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

.color-option.auto {
    background: conic-gradient(var(--color-1), var(--color-2), var(--color-3),
            var(--color-4), var(--color-5), var(--color-6),
            var(--color-7), var(--color-8), var(--color-9),
            var(--color-10), var(--color-11), var(--color-12),
            var(--color-1));
}

/* 優先度入力 */
.priority-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.priority-input .form-input {
    width: 80px;
    text-align: center;
}

.priority-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* フォームアクション */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans JP', sans-serif;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

.btn-danger {
    background: #a65c5c;
    border: none;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}



/* ===================================
   設定モーダル
   =================================== */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.settings-label {
    font-size: 14px;
    color: var(--text-primary);
}

.settings-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===================================
   アニメーション
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* ===================================
   レスポンシブ調整
   =================================== */
@media (max-width: 360px) {
    .circle-container {
        max-width: 280px;
    }

    .current-time {
        font-size: 28px;
    }
}