/* チェキ管理アプリ - スタイルシート */

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal.flex {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    padding: 24px;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content-lg {
    max-width: 700px;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.comeback-code {
    background-color: #eef2ff;
    color: #4338ca;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 3px;
    padding: 1rem;
    text-align: center;
    font-size: 1.5rem;
    border-radius: 0.375rem;
    user-select: all;
    cursor: pointer;
}

.login-btn {
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-placeholder {
    width: 100%;
    height: 200px;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: #757575;
    font-size: 1rem;
    border: 2px dashed #cbd5e0;
}

.image-preview,
.detail-image-preview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 0.375rem;
    margin: 10px auto;
    display: block;
}

.detail-image-preview {
    max-height: 400px;
    margin-bottom: 1rem;
}

.tag {
    background-color: #e0e7ff;
    color: #3730a3;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
    font-weight: 500;
}

.loading-spinner,
.upload-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #4f46e5;
    animation: spin 1s ease infinite;
    margin: 20px auto;
}

.upload-spinner {
    width: 24px;
    height: 24px;
    margin: 0 10px 0 0;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2d3748;
    color: white;
    padding: 12px 24px;
    border-radius: 0.375rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.toast.show {
    opacity: 1;
}

.custom-file-input-label {
    display: block;
    padding: 0.5rem 1rem;
    background-color: #4f46e5;
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
    font-weight: 500;
}

.custom-file-input-label:hover {
    background-color: #4338ca;
}

#imageFile {
    display: none;
}

.upload-status {
    font-size: 0.875rem;
    color: #4a5568;
    margin-top: 0.5rem;
}

/* アプリ全体でテキスト選択と長押しメニュー（コピー等）を無効化（よりネイティブアプリに近づける） */
body {
    -webkit-touch-callout: none;
    /* iOS Safari用 長押しメニュー禁止 */
    -webkit-user-select: none;
    /* Safari用 テキスト選択禁止 */
    user-select: none;
    /* 標準 テキスト選択禁止 */
}

/* ただし、入力フォーム（テキストボックスやメモ欄）はテキスト選択・コピペができるように除外 */
input,
textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* 画像のドラッグ禁止を別途定義 */
.prevent-select {
    -webkit-user-drag: none;
}

/* アクセシビリティ: キーボード操作時のフォーカス表示 */
*:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
    border-radius: 2px;
}

/* アクセシビリティ: アニメーションを減らす設定を尊重 */
@media (prefers-reduced-motion: reduce) {

    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- モバイル環境でのズーム問題（UX改善） --- */

/* 1. ダブルタップによる意図しない不自然なズームを防止（ピンチでの操作はそのまま可能） */
a,
button,
input,
select,
textarea,
.modal,
.click-element {
    touch-action: manipulation;
}

/* 2. iOS Safariでの入力欄フォーカス時の自動ズームを防止（フォントが16px未満の時に発生する仕様への対策） */
@media screen and (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* 3. iOS のカレンダー入力 (type="date") でっぱり・グレー背景を強力にリセット */
input[type="date"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-color: transparent !important;
    min-height: 42px;
    /* iOSでの見切れを防止 */
}