/* SpeedReader Pro v2 - Windows 11 最適化版 */

:root {
    --primary-color: #007BFF;
    --success-color: #28A745;
    --warning-color: #FFC107;
    --danger-color: #DC3545;
    --dark-color: #333;
    --light-color: #F8F9FA;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* ヘッダー */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
}

.version {
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

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

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

.logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #c82333;
}

/* メインコンテナ */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    padding: 0 1rem;
}

/* サイドバー */
.sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 120px;
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* 速度コントロール */
.speed-slider {
    margin-bottom: 1rem;
}

.speed-slider input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.speed-display {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.speed-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

.preset-btn {
    background: var(--light-color);
    border: 2px solid #ddd;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    text-align: center;
}

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

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

/* 音声選択 */
.voice-options {
    margin-bottom: 1rem;
}

.voice-options label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.voice-options select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    background: white;
    font-size: 0.9rem;
}

.voice-params {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.voice-params label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.voice-params input[type="range"] {
    width: 100%;
    margin-top: 0.3rem;
}

/* 特殊機能 */
.feature-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feature-btn {
    background: var(--light-color);
    border: 2px solid #ddd;
    padding: 0.7rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.feature-btn:hover {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.feature-btn.active {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* メインコンテンツ */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

/* タブ */
.tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* テキスト入力 */
#textInput {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.text-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.char-count {
    color: #666;
    font-size: 0.9rem;
}

.tool-btn {
    background: var(--light-color);
    border: 2px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-left: 0.5rem;
}

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

/* ファイルアップロード */
.upload-area {
    border: 3px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    background: var(--light-color);
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition);
}

.upload-btn:hover {
    background: #0056b3;
}

/* 再生コントロール */
.playback-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--light-color);
    border: 2px solid #ddd;
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

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

.control-btn.primary:hover:not(:disabled) {
    background: #0056b3;
}

.control-btn .icon {
    font-size: 1.5rem;
}

.control-btn .label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* 進行状況 */
.progress-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border: 2px solid #eee;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

/* デバイス間同期セクション */
.sync-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
}

.sync-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.sync-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.jump-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius);
}

.jump-control label {
    font-weight: 600;
    min-width: 100px;
}

.jump-control input {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    text-align: center;
}

.progress-share {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sync-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.sync-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.sync-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
}

.qr-display {
    margin-top: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.qr-display h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#qrCode {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

#qrCode canvas {
    border: 3px solid var(--primary-color);
    border-radius: var(--border-radius);
}

/* 読み上げ表示 */
.reading-display {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(40, 167, 69, 0.1);
    border-radius: var(--border-radius);
    border: 2px solid var(--success-color);
}

.reading-text {
    font-size: 1.1rem;
    line-height: 1.8;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.reading-text .highlight {
    background: #ffeb3b;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: bold;
}

/* 統計 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--box-shadow);
    border-top: 4px solid var(--primary-color);
}

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

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* フッター */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    margin-top: 3rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
    color: #666;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.link-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

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

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--border-radius);
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--primary-color);
    color: white;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* トースト通知 */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--box-shadow);
    border-left: 4px solid var(--success-color);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

    .sidebar {
        position: static;
        order: 2;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .playback-controls {
        gap: 0.5rem;
    }

    .control-btn {
        min-width: 80px;
        padding: 0.7rem;
    }

    .progress-share {
        flex-direction: column;
    }

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

/* Windows 11 特有のスタイル */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #ffffff;
        --light-color: #2d2d30;
    }

    body {
        background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    }

    .header,
    .sidebar,
    .main-content {
        background: rgba(45, 45, 48, 0.95);
        color: var(--dark-color);
    }

    .modal-content {
        background: #2d2d30;
        color: white;
    }
}

/* Windows 11 のアクリル効果を模倣 */
.acrylic {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 高速スライダーの拡張表示 */
.speed-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.speed-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* QRコード生成のためのスタイル */
.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.qr-code-info {
    background: rgba(0, 123, 255, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
    font-size: 0.9rem;
    text-align: center;
    max-width: 400px;
}

/* 進捗同期の成功・エラー表示 */
.sync-success {
    background: rgba(40, 167, 69, 0.1);
    border-left-color: var(--success-color);
    color: #155724;
}

.sync-error {
    background: rgba(220, 53, 69, 0.1);
    border-left-color: var(--danger-color);
    color: #721c24;
}

.sync-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: var(--warning-color);
    color: #856404;
}