/**
 * プログラミングクラブタイマー - スタイルシート
 * Office 36.5
 */

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

body {
    font-family: 'Arial', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

/* ========================================
   PDF表示エリア
   ======================================== */
.pdf-container {
    flex: 0 0 35%;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.pdf-container.hidden {
    flex: 0 0 0%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    width: 0;
}

.pdf-container h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 3em;
}

.pdf-container img {
    max-width: 100%;
    height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: 10px;
    cursor: pointer;
}

/* ========================================
   メインコンテナ
   ======================================== */
.container {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 5px;
    font-size: 3.5em;
}

/* ========================================
   現在のアクティビティ表示
   ======================================== */
.current-activity {
    text-align: center;
    margin-bottom: 5px;
}

.activity-name {
    font-size: 4.5em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    line-height: 1;
}

.activity-time {
    font-size: 2.5em;
    color: #666;
}

/* ========================================
   タイマー表示
   ======================================== */
.timer-display {
    text-align: center;
    margin: 5px 0;
}

.time {
    font-size: 18em;
    font-weight: bold;
    color: #667eea;
    font-family: 'Courier New', monospace;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
    line-height: 0.9;
}

.time.warning {
    color: #f39c12;
    animation: pulse 1s infinite;
}

.time.danger {
    color: #e74c3c;
    animation: pulse 0.5s infinite;
}

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

/* ========================================
   プログレスバー
   ======================================== */
.progress-bar {
    width: 100%;
    height: 50px;
    background: #f0f0f0;
    border-radius: 25px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 1s linear;
}

/* ========================================
   スケジュール表示
   ======================================== */
.schedule {
    margin-top: 8px;
    flex-shrink: 0;
}

.schedule-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    margin-bottom: 10px;
    gap: 15px;
}

.schedule h2 {
    font-size: 3.5em;
    margin: 0;
    font-weight: bold;
    color: #667eea;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    padding: 28px 35px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 20px;
    border-left: 15px solid #ddd;
    font-size: 3em;
    font-weight: 500;
}

.schedule-item.active {
    background: #e8eaf6;
    border-left-color: #667eea;
    font-weight: bold;
}

.schedule-item.completed {
    opacity: 0.6;
    background: #e8f5e9;
    border-left-color: #4caf50;
}

/* ========================================
   メッセージ表示
   ======================================== */
.message {
    text-align: center;
    font-size: 2.5em;
    color: #4caf50;
    margin: 8px 0;
    font-weight: bold;
}

/* ========================================
   音量モニター
   ======================================== */
.volume-monitor {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin: 8px 0;
    flex-shrink: 0;
}

.volume-monitor h2 {
    font-size: 2.2em;
    margin-bottom: 10px;
    color: #667eea;
    text-align: center;
}

.volume-bar-container {
    width: 100%;
    height: 40px;
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    margin: 10px 0;
}

.volume-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 50%, #ffc107 70%, #ff5722 100%);
    transition: width 0.1s ease;
}

.volume-bar.warning {
    animation: pulse 0.5s infinite;
}

.volume-info {
    display: flex;
    justify-content: space-around;
    font-size: 1.6em;
    margin: 10px 0;
    color: #333;
}

.volume-info span {
    font-weight: bold;
    color: #667eea;
}

#micToggle {
    display: block;
    margin: 10px auto 0;
    background: #667eea;
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.6em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

#micToggle:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#micToggle.active {
    background: #e74c3c;
}

#micToggle.active:hover {
    background: #c0392b;
}

/* ========================================
   騒音アラート
   ======================================== */
.noise-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(76, 175, 80, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.noise-alert.show {
    opacity: 1;
}

.noise-alert.fade-out {
    opacity: 0;
}

.alert-content {
    text-align: center;
}

.alert-icon {
    font-size: 30em;
}

/* ========================================
   編集ボタン
   ======================================== */
.edit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 35px;
    font-size: 2em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.edit-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.edit-btn.editing {
    background: #4caf50;
}

.test-sound-btn {
    background: #ff9800;
    color: white;
    border: none;
    padding: 15px 35px;
    font-size: 2em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.test-sound-btn:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

/* ========================================
   スケジュール編集モード
   ======================================== */
.schedule-item.edit-mode {
    flex-direction: column;
    gap: 10px;
}

.schedule-edit-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.schedule-edit-row input {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.schedule-edit-row input:focus {
    outline: none;
    border-color: #667eea;
}

.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    font-size: 1em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: #c0392b;
}

.add-item-btn {
    display: block;
    width: 100%;
    background: #4caf50;
    color: white;
    border: none;
    padding: 20px;
    font-size: 2.2em;
    border-radius: 15px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
    font-weight: bold;
}

.add-item-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* ========================================
   ユーティリティクラス
   ======================================== */
.hidden {
    display: none;
}

/* ========================================
   ルビ（ふりがな）入力
   ======================================== */
.ruby-input-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ruby-input-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.ruby-input-row input[type="text"] {
    flex: 1;
}

.ruby-input-row input.ruby-reading {
    flex: 0.5;
    font-size: 0.9em;
}

.ruby-btn {
    background: #9c27b0;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.ruby-btn:hover {
    background: #7b1fa2;
}

.ruby-auto-btn {
    background: #ff9800;
}

.ruby-auto-btn:hover {
    background: #f57c00;
}

.ruby-help {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
}

/* ========================================
   画像拡大モーダル
   ======================================== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.image-modal.show {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.modal-image.zoomed {
    cursor: zoom-out;
    transform: scale(1.5);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.close-modal:hover {
    color: #ccc;
}

/* ========================================
   使用方法ボタン
   ======================================== */
.manual-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #4caf50;
    color: white;
    border: none;
    padding: 20px 35px;
    font-size: 2em;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
    transition: all 0.3s;
    z-index: 1000;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
}

.manual-btn:hover {
    background: #45a049;
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(76, 175, 80, 0.6);
}

.manual-btn .icon {
    font-size: 1.2em;
    margin-right: 10px;
}

/* 管理画面ボタン */
.admin-btn {
    position: fixed;
    bottom: 30px;
    right: 230px;
    background: #ff9800;
    color: white;
    border: none;
    padding: 20px 35px;
    font-size: 2em;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
    transition: all 0.3s;
    z-index: 1000;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
}

.admin-btn:hover {
    background: #f57c00;
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 152, 0, 0.6);
}

.admin-btn .icon {
    font-size: 1.2em;
    margin-right: 10px;
}

/* ========================================
   画像表示/非表示トグルボタン
   ======================================== */
.toggle-image-btn {
    position: fixed;
    top: 30px;
    left: 30px;
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 2em;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    z-index: 1000;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-image-btn:hover {
    background: #5568d3;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.toggle-image-btn .icon {
    font-size: 1.3em;
}

/* ========================================
   エラー通知
   ======================================== */
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #f44336;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
    font-size: 1.2em;
    font-weight: bold;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.error-notification.show {
    opacity: 1;
    transform: translateX(0);
}
