/* Text Replacer Tool Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: #666;
    font-size: 1.2em;
}

.hidden {
    display: none !important;
}

/* ===== セクション共通スタイル ===== */
.usage-section,
.feature-section,
.ad-section {
    background: white;
    margin-bottom: 30px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* ===== メインコンテナ ===== */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ===== 入力セクション ===== */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-card,
.result-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-bottom: 1px solid #93c5fd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.char-counter {
    font-size: 0.875rem;
    color: #1e40af;
    font-weight: 600;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.error {
    color: #ef4444;
}

.text-input,
.text-output {
    width: 100%;
    min-height: 250px;
    padding: 1.5rem;
    border: none;
    resize: vertical;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: #fafafa;
    color: #374151;
}

.text-input:focus,
.text-output:focus {
    outline: none;
    background: #ffffff;
}

.text-output {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

/* ===== 置換設定 ===== */
.replace-settings {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.settings-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.replace-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.replace-input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.replace-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.arrow-icon {
    color: #6b7280;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 0.75rem;
}

/* ===== オプション ===== */
.replace-options {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.option-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #3b82f6;
}

/* ===== ボタンスタイル ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    width: 100%;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-outline {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* ===== 結果セクション ===== */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.replace-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #10b981;
    background: #dcfce7;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.result-content {
    padding: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ===== 履歴セクション ===== */
.history-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.history-title {
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    padding: 2rem;
}

.history-item {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-find {
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.history-replace {
    font-size: 0.875rem;
    color: #10b981;
    font-weight: 600;
}

.history-arrow {
    color: #6b7280;
    margin: 0 0.5rem;
}

/* ===== 使い方・特徴カード ===== */
.usage-cards,
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.usage-card,
.feature-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.usage-card:hover,
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.usage-step {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.feature-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.usage-content,
.feature-content {
    flex: 1;
}

.usage-content h3,
.feature-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.usage-content p,
.feature-content p {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
}

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

.result-card {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.processing {
    animation: pulse 1s infinite;
}

/* ===== レスポンシブデザイン ===== */
@media (max-width: 1024px) {
    .replace-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .arrow-icon {
        transform: rotate(90deg);
        padding-bottom: 0;
    }
}

@media (max-width: 768px) {
    .subtitle {
        font-size: 1rem;
    }
    
    .usage-section,
    .feature-section,
    .ad-section {
        padding: 20px;
    }
    
    .card-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        text-align: center;
    }
    
    .replace-options {
        flex-direction: column;
        gap: 1rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-info {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .usage-cards,
    .feature-cards {
        grid-template-columns: 1fr;
    }
    
    .usage-card,
    .feature-card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        gap: 1rem;
    }
    
    .replace-settings,
    .input-card,
    .result-card,
    .history-section {
        padding: 1rem;
    }
    
    .text-input,
    .text-output {
        min-height: 200px;
        padding: 1rem;
    }
    
    .usage-card,
    .feature-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}