:root {
    --primary-color: #4A90E2;
    --secondary-color: #F5F7FA;
    --accent-color: #50C878;
    --danger-color: #E74C3C;
    --text-color: #2C3E50;
    --bg-color: #FFFFFF;
    --border-color: #E1E8ED;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-color: #5DADE2;
    --secondary-color: #2C3E50;
    --accent-color: #58D68D;
    --danger-color: #EC7063;
    --text-color: #ECF0F1;
    --bg-color: #1A252F;
    --border-color: #34495E;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 30px;
    min-height: 500px;
}

/* 設定パネル */
.settings-panel {
    background: var(--secondary-color);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.file-upload-area {
    margin-bottom: 25px;
}

.upload-zone {
    border: 3px dashed var(--primary-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    background-color: var(--primary-color);
    color: white;
}

.upload-zone.dragover {
    background-color: var(--primary-color);
    color: white;
}

.csv-save-section {
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.csv-save-section label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.csv-save-section input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.saved-csv-section {
    margin-bottom: 25px;
}

.saved-csv-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.saved-csv-list {
    max-height: 200px;
    overflow-y: auto;
}

.saved-csv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: var(--bg-color);
    border-radius: 6px;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

.saved-csv-item:hover {
    border-color: var(--primary-color);
}

.saved-csv-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.csv-info {
    flex: 1;
    cursor: pointer;
}

.csv-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.csv-details {
    font-size: 0.85rem;
    opacity: 0.8;
}

.csv-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load {
    background-color: var(--accent-color);
    color: white;
}

.btn-load:hover {
    background-color: #45B570;
}

.btn-delete {
    background-color: var(--danger-color);
    color: white;
}

.btn-delete:hover {
    background-color: #C0392B;
}

.no-saved-csv {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* ブックマーク機能 */
.bookmark-section {
    margin-bottom: 25px;
}

.bookmark-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.bookmarked-words {
    max-height: 200px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: var(--bg-color);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.bookmark-item:hover {
    border-color: var(--primary-color);
}

.bookmark-word {
    font-weight: bold;
    flex: 1;
}

.bookmark-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.bookmark-remove:hover {
    background-color: #C0392B;
}

.no-bookmarks {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 15px;
}

.bookmark-btn {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.btn-bookmark {
    background-color: #FFD700;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.btn-bookmark:hover {
    background-color: #FFC700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-bookmark.bookmarked {
    background-color: var(--accent-color);
    color: white;
}

.btn-bookmark.bookmarked:hover {
    background-color: #45B570;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.settings-group input,
.settings-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
}

/* フラッシュカード表示エリア */
.flashcard-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.flashcard-display {
    width: 100%;
    height: 400px;
    background: var(--secondary-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.welcome-message h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.welcome-message p {
    font-size: 1rem;
    margin: 10px 0;
}

.countdown {
    font-size: 4rem !important;
    color: var(--accent-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.progress-bar {
    width: 100%;
    height: 30px;
    background-color: var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: var(--text-color);
}

/* 履歴パネル */
.history-panel {
    background: var(--secondary-color);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    max-height: 600px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-list {
    max-height: 500px;
    overflow-y: auto;
}

.session-header {
    font-weight: bold;
    color: var(--primary-color);
    margin: 15px 0 10px 0;
    padding: 8px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.history-item {
    padding: 12px;
    margin: 8px 0;
    background: var(--bg-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.history-item.bookmarked {
    border-left-color: #FFD700;
    background-color: rgba(255, 215, 0, 0.1);
}

.history-word {
    flex: 1;
    cursor: pointer;
}

.bookmark-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.bookmark-toggle:hover {
    background-color: rgba(255, 215, 0, 0.2);
    transform: scale(1.2);
}

.no-history {
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ボタン */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background-color: #357ABD;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-danger:hover {
    background-color: #C0392B;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    box-shadow: var(--shadow);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: var(--danger-color);
}

#modalWord {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2rem;
}

.modal-content p {
    margin: 15px 0;
    line-height: 1.6;
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .flashcard-display {
        height: 300px;
        font-size: 2.5rem;
    }
}
