/* 文字数カウンター ツール固有CSS */

/* カウント設定セクション */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.setting-group h4 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s;
}

.checkbox-group label:hover {
    color: var(--primary-blue);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group span {
    font-size: 0.95rem;
}

/* 目標設定 */
.target-settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.target-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1.5rem;
}

.target-input-group input[type="number"] {
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 1rem;
    width: 120px;
}

.target-input-group input[type="number"]:disabled {
    background-color: var(--bg-light);
    cursor: not-allowed;
}

/* モード選択 */
.mode-selector h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.mode-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mode-tab {
    flex: 1;
    min-width: 150px;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mode-tab:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.mode-tab.active {
    border-color: var(--primary-blue);
    background: var(--primary-blue);
    color: white;
}

.mode-tab i {
    font-size: 1.5rem;
}

.mode-tab span {
    font-weight: 500;
}

/* 処理モード */
.processing-mode {
    display: none;
}

.processing-mode.active {
    display: block;
}

/* 入力セクション */
.input-section h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.text-input-container {
    position: relative;
}

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

.input-header label {
    font-weight: 500;
    color: var(--text-dark);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: #1f7ab8;
    transform: translateY(-2px);
}

.action-btn.success {
    background: var(--success-green);
}

#main-text {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    transition: border-color 0.3s;
}

#main-text:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* リアルタイム統計 */
.live-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-item[data-hidden="true"] {
    display: none;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-medium);
}

/* 進捗セクション */
.progress-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.progress-section h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-green), var(--primary-blue));
    transition: width 0.3s ease;
    border-radius: 15px;
}

.progress-fill.over-target {
    background: linear-gradient(90deg, var(--warning-orange), var(--error-red));
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-medium);
}

.progress-info .over-target {
    color: var(--error-red);
    font-weight: 600;
}

/* 詳細統計 */
.detailed-stats h3 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2rem;
    color: var(--primary-blue);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.stat-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stat-desc {
    font-size: 0.85rem;
    color: var(--text-medium);
}

/* 文字種別統計 */
.character-breakdown {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.character-breakdown h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.breakdown-label {
    font-weight: 500;
    color: var(--text-dark);
}

.breakdown-value {
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1.1rem;
}

/* エクスポートセクション */
.export-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.export-section h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.export-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.export-btn {
    background: var(--success-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.export-btn:hover {
    background: #4CAF50;
    transform: translateY(-2px);
}

/* ファイルアップロード */
.upload-area {
    border: 3px dashed var(--border-light);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-blue);
    background: rgba(41, 144, 208, 0.05);
}

.upload-area.dragover {
    border-color: var(--success-green);
    background: rgba(19, 174, 103, 0.1);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.upload-area h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.upload-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.upload-btn:hover {
    background: #1f7ab8;
}

.file-results {
    margin-top: 2rem;
}

.file-results h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.batch-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* 比較モード */
.compare-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: start;
}

.compare-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compare-header label {
    font-weight: 600;
    color: var(--text-dark);
}

.compare-item textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}

.compare-item textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.compare-stats {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
}

.compare-stat {
    flex: 1;
    text-align: center;
}

.compare-stat .stat-label {
    font-size: 0.85rem;
    color: var(--text-medium);
}

.compare-stat .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.compare-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.vs-label {
    background: var(--primary-blue);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50%;
    font-weight: 700;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: #e09930;
}

.comparison-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.comparison-results h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.diff-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.diff-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.diff-label {
    font-weight: 500;
    color: var(--text-dark);
}

.diff-value {
    font-weight: 700;
    font-size: 1.2rem;
}

.diff-value.positive {
    color: var(--success-green);
}

.diff-value.negative {
    color: var(--error-red);
}

.diff-value.zero {
    color: var(--text-medium);
}

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

.history-section h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.history-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.history-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-btn:hover {
    background: #1f7ab8;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.history-item {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.history-item h5 {
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.history-meta {
    font-size: 0.85rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.history-stat {
    text-align: center;
    padding: 0.5rem;
    background: var(--white);
    border-radius: 6px;
}

.history-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.history-stat-label {
    font-size: 0.8rem;
    color: var(--text-medium);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
}

.modal-content h3 {
    color: var(--text-dark);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content ul,
.modal-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.close {
    color: var(--text-medium);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: var(--text-dark);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .live-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .compare-container {
        grid-template-columns: 1fr;
    }

    .compare-divider {
        flex-direction: row;
    }

    .mode-tabs {
        flex-direction: column;
    }

    .mode-tab {
        min-width: 100%;
    }

    .export-actions {
        flex-direction: column;
    }

    .export-btn {
        width: 100%;
        justify-content: center;
    }
}
