/* re:days カスタムCSS */

/* スクロールバー */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* iOS ズーム防止: input/textarea は 16px 以上 */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* テキストエリア自動リサイズ */
.auto-resize {
    resize: none;
    overflow: hidden;
    min-height: 240px;
}

/* 日記エントリ */
.diary-entry {
    transition: background-color 0.15s ease;
}
.diary-entry:hover {
    background-color: #fafafa;
}

/* カレンダードット */
.cal-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin: 0 1px;
    vertical-align: middle;
}
.cal-dot-current { background-color: #ef4444; }
.cal-dot-prev1   { background-color: #3b82f6; }
.cal-dot-prev2   { background-color: #22c55e; }
.cal-dot-older   { background-color: #6b7280; }

/* カレンダーセル */
.cal-day {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    font-size: 0.8125rem;
    transition: background-color 0.1s;
}
.cal-day:hover {
    background-color: #fee2e2;
}
.cal-day.today {
    background-color: #ef4444;
    color: white;
    font-weight: bold;
}
.cal-day.selected:not(.today) {
    color: #ef4444;
    font-weight: bold;
}
.cal-day.other-month {
    color: #d1d5db;
}

/* カレンダードットコンテナ */
.cal-dots {
    display: flex;
    justify-content: center;
    gap: 1px;
    margin-top: -2px;
}

/* 画像サムネイル */
.img-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.img-thumb:hover {
    opacity: 0.8;
}

/* 添付ファイル（PDF等）タイル */
.attachment-thumb {
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
    overflow: hidden;
}
.attachment-thumb:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}
.attachment-thumb-label {
    font-size: 10px;
    line-height: 1.2;
    width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ライトボックス */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.lightbox.active {
    display: flex;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 12px 16px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    user-select: none;
}
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.3);
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ドラッグ並び替え */
.drag-handle {
    cursor: grab;
}
.drag-handle:active {
    cursor: grabbing;
}
.dragging {
    opacity: 0.5;
}
.drag-over {
    border: 2px dashed #ef4444;
}

/* 検索ハイライト */
mark {
    background-color: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

/* ナビバー */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* コンテンツ */
.content-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.75;
}

/* 月別アーカイブ */
.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.1s;
}
.archive-item:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* お気に入り */
.star-btn {
    transition: transform 0.15s, color 0.15s;
}
.star-btn:hover {
    transform: scale(1.2);
}

/* ローディング */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* モバイル用サイドバー */
@media (max-width: 768px) {
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
    }
    .sidebar-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        overflow-y: auto;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    .sidebar-panel.open {
        transform: translateX(0);
    }

    /* モバイルでのテキストエリア高さ上限（カーソル飛び防止） */
    .auto-resize {
        min-height: 120px;
        max-height: 200px;
        overflow-y: auto;
    }
}

/* フェードイン */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in {
    animation: fadeIn 0.2s ease forwards;
}

/* 写真グリッド */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.photo-grid-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
}
.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}
.photo-grid-item:hover img {
    transform: scale(1.05);
}

/* スクロールトップボタン */
#scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    display: none;
}
#scroll-top.visible {
    display: block;
}

/* プライバシーロック */
.privacy-lock {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 250, 251, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: opacity 0.3s ease;
}
.privacy-lock.unlocked {
    opacity: 0;
    pointer-events: none;
}
