:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --secondary-color: #42526E;
    --success-color: #00875A;
    --warning-color: #FF991F;
    --danger-color: #DE350B;
    --background: #FAFBFC;
    --surface: #FFFFFF;
    --border: #DFE1E6;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.08), 0 3px 8px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
}

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

header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    margin-bottom: 20px;
}

.lang-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

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

.format-selector {
    margin-bottom: 30px;
}

.format-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

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

.converter-section {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.input-section,
.output-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

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

.section-header h2 {
    font-size: 1.2em;
    color: var(--text-primary);
    font-weight: 600;
}

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

.btn-clear,
.btn-paste,
.btn-sample,
.btn-copy,
.btn-download {
    padding: 6px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
}

.btn-clear:hover,
.btn-paste:hover,
.btn-sample:hover,
.btn-copy:hover,
.btn-download:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

textarea {
    width: 100%;
    height: 200px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition);
    background: var(--background);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
    background: white;
}

textarea[readonly] {
    background: var(--background);
    cursor: default;
}

.char-count {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.control-section {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary svg {
    flex-shrink: 0;
}

.options {
    display: flex;
    gap: 20px;
    margin-left: auto;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.format-info {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.format-info h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.format-description {
    color: var(--text-secondary);
    line-height: 1.8;
}

.history-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.history-section .section-header {
    margin-bottom: 20px;
}

.btn-clear-history {
    padding: 6px 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
}

.btn-clear-history:hover {
    background: #BF2600;
    transform: translateY(-1px);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.history-header {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
}

.history-format {
    padding: 2px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.history-type {
    padding: 2px 8px;
    background: var(--success-color);
    color: white;
    border-radius: var(--radius-sm);
}

.history-time {
    color: var(--text-secondary);
    margin-left: auto;
}

.history-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    font-family: monospace;
    font-size: 12px;
}

.history-input,
.history-output {
    padding: 6px;
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-arrow {
    color: var(--text-secondary);
}

.features {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.features h3 {
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-primary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.feature-card {
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

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

.feature-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.feature-card h4 {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 50px;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    background: var(--success-color);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 1000;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .format-tabs {
        padding: 8px;
        gap: 5px;
    }
    
    .tab-btn {
        min-width: 70px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .control-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .options {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    textarea {
        height: 150px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .history-content {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .history-arrow {
        display: none;
    }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
    /* ダークモードスタイルを後で追加可能 */
}

/* スクロールバーのスタイリング */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

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

.history-item {
    animation: fadeIn 0.3s ease;
}

/* プリント対応 */
@media print {
    body {
        background: white;
    }
    
    header,
    .lang-switcher,
    .actions,
    .control-section,
    .history-section,
    .features,
    footer,
    .toast {
        display: none;
    }
    
    .container {
        max-width: 100%;
    }
    
    textarea {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}