/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --secondary-color: #6B778C;
    --background: #FAFBFC;
    --surface: #FFFFFF;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --border-color: #DFE1E6;
    --success-color: #00875A;
    --error-color: #DE350B;
    --warning-color: #FF991F;
    --info-color: #0065FF;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0 20px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 言語切り替えボタン */
.lang-switcher {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.lang-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 入力セクション */
.input-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

#textInput {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 統計グリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* プリセットセクション */
.presets-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.presets-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.preset-card {
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preset-name {
    font-weight: 600;
    color: var(--text-primary);
}

.preset-limit {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.preset-progress {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 4px;
}

.progress-bar.twitter { background: #1DA1F2; }
.progress-bar.instagram { background: #E4405F; }
.progress-bar.facebook { background: #1877F2; }
.progress-bar.linkedin { background: #0A66C2; }

.progress-bar.over-limit {
    background: var(--error-color);
}

.preset-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.preset-status.over-limit {
    color: var(--error-color);
    font-weight: 600;
}

/* アクションボタン */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--text-secondary);
}

/* フッター */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .presets-grid {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .lang-switcher {
        flex-wrap: wrap;
    }
    
    .lang-btn {
        flex: 1;
        min-width: 70px;
    }
}