/* settings.css - 統一設定ウィンドウ用スタイル */

@import "variables.css";

/* 設定モーダル */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.settings-modal.active {
    display: flex;
}

/* 設定ウィンドウ */
.settings-window {
    background: var(--color-bg-white);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ヘッダー */
.settings-header {
    background: var(--gradient-brand);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.settings-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* タブナビゲーション */
.settings-tabs {
    display: flex;
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none; /* IE/Edge */
    flex-shrink: 0;
    min-height: 48px;
}

/* スクロールバーを非表示（Webkit系ブラウザ） */
.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab {
    flex: 0 0 auto;
    min-width: fit-content;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #718096;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.settings-tab:hover {
    background: #edf2f7;
    color: #4a5568;
}

.settings-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: var(--color-bg-white);
}

.settings-tab i {
    font-size: 16px;
}

/* タブコンテンツ */
.settings-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
}

.settings-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* セクション */
.settings-section {
    margin-bottom: 30px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

/* カード風セクション */
.settings-section-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.settings-section-card:last-child {
    margin-bottom: 0;
}

.settings-section-card .settings-section-title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 12px;
}

/* カードの左ボーダー（色分け） */
.settings-section-card.card-email {
    border-left: 4px solid var(--color-info-dark);
}

.settings-section-card.card-password {
    border-left: 4px solid #10b981;
}

.settings-section-card.card-delete {
    border-left: 4px solid #ef4444;
}

.settings-section-description {
    color: #718096;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.6;
}

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

.settings-form-group label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 14px;
}

.settings-form-group input[type="text"],
.settings-form-group input[type="email"],
.settings-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.settings-form-group input:focus,
.settings-form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-form-group .help-text {
    font-size: 13px;
    color: #718096;
    margin-top: 5px;
}

/* Google Drive 接続状態 */
.drive-connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 15px;
}

.drive-connection-status.connected {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
}

.drive-connection-status.disconnected {
    background: #fff5f5;
    border: 1px solid #fc8181;
}

.drive-status-icon {
    font-size: 24px;
}

.drive-status-icon.connected {
    color: var(--color-success-dark);
}

.drive-status-icon.disconnected {
    color: #e53e3e;
}

.drive-status-info {
    flex: 1;
}

.drive-status-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
}

.drive-status-info p {
    margin: 0;
    font-size: 13px;
    color: #718096;
}

/* デバイス管理 */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.device-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.device-item.current-device {
    background: #e6fffa;
    border-color: #81e6d9;
}

.device-icon {
    font-size: 28px;
    color: var(--color-primary);
    margin-right: 15px;
}

.device-item.current-device .device-icon {
    color: #5cb3ab;
}

.device-info {
    flex: 1;
}

.device-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
}

.device-info p {
    margin: 0;
    font-size: 13px;
    color: #718096;
}

.current-device-badge {
    display: inline-block;
    background: #5cb3ab;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.btn-refresh-devices {
    background: var(--color-info-dark);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh-devices:hover {
    background: #5a95d8;
}

.btn-refresh-devices:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

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

.btn-device-delete {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-device-delete:hover {
    background: #c53030;
    transform: translateY(-1px);
}

.btn-device-delete:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

/* ボタン */
.settings-button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-settings-primary {
    background: var(--gradient-brand);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-settings-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-settings-secondary {
    background: var(--color-bg-white);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-settings-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-settings-danger {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-settings-danger:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-state i {
    font-size: 48px;
    color: #cbd5e0;
    margin-bottom: 15px;
}

.empty-state p {
    margin: 0;
    font-size: 15px;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .settings-window {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .settings-header {
        padding: 15px 20px;
    }

    .settings-header h2 {
        font-size: 20px;
    }

    .settings-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .settings-tab {
        flex: 0 0 auto;
        min-width: fit-content;
        padding: 10px 12px;
        font-size: 12px;
    }

    .settings-content {
        padding: 20px 15px;
    }

    .settings-section-title {
        font-size: 16px;
    }

    .device-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .device-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .settings-button-group {
        flex-direction: column;
    }

    .settings-button-group button {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .settings-tab {
        flex: 0 0 auto;
        min-width: fit-content;
        padding: 8px 10px;
        font-size: 11px;
    }

    .settings-tab i {
        font-size: 12px;
    }

    .device-icon {
        font-size: 24px;
    }
}
/* ========================================
   表示設定のスタイル
   ======================================== */

/* ===== テーマ設定 ===== */
/* 注意: 基本カラー変数は variables.css で定義されています */

/* ライトテーマ（デフォルト）- variables.css の値を継承 */

/* ダークテーマ */
[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-tertiary: #cbd5e0;
    --border-color: #4a5568;
    --shadow: rgba(0, 0, 0, 0.5);
}

/* ダークテーマの背景と文字色を適用 */
[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .book-card,
[data-theme="dark"] .settings-window,
[data-theme="dark"] .modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .settings-header,
[data-theme="dark"] header {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

/* ===== フォント設定 ===== */

/* 明朝体 */
.font-serif,
.font-serif *:not(.fas):not(.far):not(.fal):not(.fat):not(.fab):not([class*="fa-"]) {
    font-family: "游明朝", "Yu Mincho", YuMincho, "Hiragino Mincho ProN", "Hiragino Mincho Pro", 
                 "HG明朝E", "MS P明朝", "MS 明朝", serif !important;
}

/* ゴシック体 */
.font-sans-serif,
.font-sans-serif *:not(.fas):not(.far):not(.fal):not(.fat):not(.fab):not([class*="fa-"]) {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "游ゴシック",
                 "Yu Gothic", Meiryo, sans-serif !important;
}

/* 等幅（Monospace） */
.font-monospace,
.font-monospace *:not(.fas):not(.far):not(.fal):not(.fat):not(.fab):not([class*="fa-"]) {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Consolas, "Liberation Mono",
                 Menlo, Monaco, "Courier New", monospace !important;
}

/* 筆記体（Cursive） */
.font-cursive,
.font-cursive *:not(.fas):not(.far):not(.fal):not(.fat):not(.fab):not([class*="fa-"]) {
    font-family: "Brush Script MT", "Segoe Script", "Comic Sans MS",
                 cursive !important;
}

/* システムUI */
.font-system-ui,
.font-system-ui *:not(.fas):not(.far):not(.fal):not(.fat):not(.fab):not([class*="fa-"]) {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif !important;
}

/* ===== フォントサイズ設定 ===== */

/* 小 */
.font-size-small {
    font-size: 14px;
}

.font-size-small .book-title {
    font-size: 16px;
}

.font-size-small .book-author {
    font-size: 13px;
}

.font-size-small .book-info {
    font-size: 12px;
}

/* 中（デフォルト） */
.font-size-medium {
    font-size: 16px;
}

.font-size-medium .book-title {
    font-size: 18px;
}

.font-size-medium .book-author {
    font-size: 15px;
}

.font-size-medium .book-info {
    font-size: 14px;
}

/* 大 */
.font-size-large {
    font-size: 18px;
}

.font-size-large .book-title {
    font-size: 22px;
}

.font-size-large .book-author {
    font-size: 17px;
}

.font-size-large .book-info {
    font-size: 16px;
}

/* 特大 */
.font-size-x-large {
    font-size: 20px;
}

.font-size-x-large .book-title {
    font-size: 26px;
}

.font-size-x-large .book-author {
    font-size: 19px;
}

.font-size-x-large .book-info {
    font-size: 18px;
}

/* ===== 表紙画像表示設定 ===== */

.hide-cover-images .book-cover-image,
.hide-cover-images .cover-preview {
    display: none !important;
}

/* ===== コンパクトモード ===== */

.compact-mode .book-card {
    padding: 12px 15px;
    margin-bottom: 10px;
}

.compact-mode .book-title {
    font-size: 16px;
    margin-bottom: 4px;
}

.compact-mode .book-author {
    font-size: 13px;
    margin-bottom: 4px;
}

.compact-mode .book-info {
    font-size: 12px;
    margin: 6px 0;
}

.compact-mode .reading-record {
    padding: 6px 10px;
    margin: 4px 0;
    font-size: 12px;
}

.compact-mode .book-cover-image {
    max-width: 60px;
    max-height: 90px;
}

.compact-mode .book-cover-image img {
    max-width: 60px !important;
    max-height: 90px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.compact-mode textarea,
.compact-mode input[type="text"],
.compact-mode input[type="date"] {
    padding: 8px;
    font-size: 13px;
}

/* 読書記録の日付・ページ範囲を小さく表示 */
.compact-mode .date-column {
    font-size: 11px;
    padding: 4px 6px;
}

.compact-mode .page-column {
    font-size: 11px;
    padding: 4px 6px;
}

.compact-mode .date-column .date-desktop,
.compact-mode .date-column .date-mobile {
    font-size: 11px;
}

.compact-mode table thead th {
    font-size: 11px;
    padding: 6px 8px;
}

/* ===== 読書記録を非表示 ===== */

.hide-reading-records .reading-records,
.hide-reading-records .records-header,
.hide-reading-records .record-row,
.hide-reading-records .add-record-btn,
.hide-reading-records table {
    display: none !important;
}

/* ===== チェックボックスのスタイル ===== */

.settings-form-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    vertical-align: middle;
}

.settings-form-group label input[type="checkbox"] {
    display: inline-block;
}

.settings-form-group label span {
    vertical-align: middle;
}

/* ===== トランジション効果 ===== */

body,
.book-card,
input,
textarea,
select,
.settings-window {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== 自動入力検出用アニメーション ===== */
@keyframes onAutoFillStart {
    from { opacity: 1; }
    to { opacity: 1; }
}

@keyframes onAutoFillCancel {
    from { opacity: 1; }
    to { opacity: 1; }
}

/* 自動入力時にアニメーションをトリガー */
input:-webkit-autofill {
    animation-name: onAutoFillStart;
    animation-duration: 0.001s;
}

input:not(:-webkit-autofill) {
    animation-name: onAutoFillCancel;
    animation-duration: 0.001s;
}

/* 自動入力された入力欄のスタイルを上書き */
/* ブラウザの自動入力は背景色を強制するため、inset box-shadow で対応 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s;
}