/* CSS Variables - カラーパレット */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #f97316;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --border-radius: 12px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--background-color) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

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

/* ヘッダー */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.team-name-header {
    font-size: 18px;
    font-weight: 500;
    color: var(--accent-color);
}

.logout-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

/* ログインセクション */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.login-card {
    background: var(--surface-color);
    padding: 48px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    font-size: 28px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, var(--text-primary), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-description {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

.input-group {
    text-align: left;
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    text-align: center;
    letter-spacing: 8px;
    font-weight: 700;
    background: var(--surface-light);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.input-group input::placeholder {
    letter-spacing: 4px;
    color: var(--secondary-color);
}

.login-button {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.error-message {
    color: var(--error-color);
    margin-top: 16px;
    font-size: 14px;
}

/* 動画セクション */
.videos-section {
    padding: 20px 0;
}

.videos-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* フォルダ（セッション） */
.video-folder {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.folder-header:hover {
    background: var(--surface-light);
}

.folder-icon {
    font-size: 24px;
}

.folder-name {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.folder-count {
    color: var(--text-secondary);
    font-size: 14px;
    background: var(--surface-light);
    padding: 4px 12px;
    border-radius: 12px;
}

.folder-arrow {
    color: var(--text-secondary);
    font-size: 12px;
    transition: transform 0.3s;
}

.folder-content {
    padding: 0 20px 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 動画カード */
.video-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.video-thumbnail {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, var(--surface-light) 0%, var(--background-color) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.play-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: white;
    transition: transform 0.3s, background 0.3s;
}

.video-card:hover .play-icon {
    transform: scale(1.1);
    background: var(--primary-color);
}

.video-details {
    padding: 20px;
}

.video-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 4px;
}

.video-owner {
    color: var(--accent-color);
    font-size: 14px;
    margin-bottom: 4px;
}

.video-date,
.video-size {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ローディング */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.spinner-small {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 動画なし */
.no-videos {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-videos p:first-child {
    font-size: 24px;
    margin-bottom: 12px;
}

.no-videos .sub-text {
    font-size: 14px;
}

/* 動画モーダル */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.close-modal:hover {
    background: var(--error-color);
}

#video-player {
    width: 100%;
    max-height: 70vh;
    background: black;
}

.video-info {
    padding: 20px;
}

.video-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.video-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ダウンロードボタン */
.download-button {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.card-download-btn {
    padding: 8px 16px;
    background: var(--surface-light);
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.card-download-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-card h1 {
        font-size: 24px;
    }

    .videos-container {
        gap: 12px;
    }

    .folder-header {
        padding: 12px 16px;
    }

    .folder-name {
        font-size: 14px;
    }

    .folder-content {
        padding: 0 12px 16px 12px;
        grid-template-columns: 1fr;
    }

    .video-thumbnail {
        height: 200px;
    }
}
/* === v1.9.1 追加: ブラウザ環境案内バナー === */
.browser-notice {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-bottom: 1px solid #f59e0b;
    color: #78350f;
}
.browser-notice-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.browser-notice-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1.2;
}
.browser-notice-text {
    flex: 1;
    min-width: 0;
}
.browser-notice-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #78350f;
}
.browser-notice-text p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: #92400e;
}
.browser-notice-copy {
    margin-top: 8px;
    background: #f59e0b;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.browser-notice-copy:hover {
    background: #d97706;
}
.browser-notice-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #92400e;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.browser-notice-close:hover {
    color: #78350f;
}

/* === v1.9.1 追加: 通知ボタン === */
.notify-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 8px;
    transition: all 0.2s;
}
.notify-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.notify-btn.on {
    background: #f59e0b;
    border-color: #f59e0b;
}

/* === v1.9.1 追加: 試合エントリ(YouTube視聴) === */
.match-entry-card {
    border-left: 4px solid #ff0000;
}
.match-entry-card .video-thumbnail.youtube-thumb {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: #fff;
    overflow: hidden;
    text-decoration: none;
}
.match-entry-card .video-thumbnail.youtube-thumb .play-icon {
    font-size: 24px;
}
.youtube-thumbnail-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.youtube-play-icon {
    position: relative;
    z-index: 1;
    padding-left: 4px;
    background: rgba(255, 0, 0, 0.9);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.match-entry-card:hover .youtube-play-icon {
    background: #ff0000;
}
.youtube-thumb-unavailable {
    background: var(--surface-light) !important;
}
.match-badge {
    display: inline-block;
    background: #ff0000;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}
.youtube-watch-btn {
    display: inline-block;
    background: #ff0000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}
.youtube-watch-btn:hover {
    background: #cc0000;
}
