/* ===== リセットと基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* タッチデバイス用の最適化 */
@media (hover: none) and (pointer: coarse) {
    button, a, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

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

/* ===== ヘッダー ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.logo i {
    font-size: 2rem;
}

.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ===== ヒーローセクション ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.95;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 40px;
}

.stat {
    text-align: center;
}

.stat i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ===== 再生リストセクション ===== */
.playlists-section {
    padding: 60px 0;
    background-color: var(--bg-secondary);
}

.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.playlist-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    text-decoration: none;
    display: block;
    border: 2px solid transparent;
}

.playlist-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.playlist-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: white;
    opacity: 0.9;
    transition: var(--transition);
}

.playlist-card:hover .playlist-icon {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
}

.playlist-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.playlist-body {
    padding: 25px;
}

.playlist-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.playlist-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.playlist-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.playlist-tag {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.playlist-link-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.playlist-card:hover .playlist-link-icon {
    gap: 10px;
}

/* ===== フィルターセクション ===== */
.filter-section {
    background-color: var(--bg-primary);
    padding: 30px 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.filter-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

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

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-select {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    background-color: white;
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

.filter-select:hover, .filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-group i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 45px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

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

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.video-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 70px;
    height: 70px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.video-card:hover .play-button {
    background-color: var(--primary-color);
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

.play-button i {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-left: 4px;
}

.video-card:hover .play-button i {
    color: white;
}

.video-duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 2;
}

.video-body {
    padding: 20px;
}

.video-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.video-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.video-category, .video-difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.video-category {
    background-color: #dbeafe;
    color: var(--primary-color);
}

.video-difficulty {
    background-color: #fef3c7;
    color: #d97706;
}

.video-difficulty.初級 {
    background-color: #d1fae5;
    color: #059669;
}

.video-difficulty.中級 {
    background-color: #fef3c7;
    color: #d97706;
}

.video-difficulty.上級 {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ===== ローディング ===== */
.loading {
    text-align: center;
    padding: 60px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.loading i {
    font-size: 2rem;
    margin-right: 10px;
}

.no-results {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results p {
    font-size: 1.2rem;
}

/* ===== モーダル ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 3% auto;
    border-radius: 12px;
    max-width: 1000px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.video-player {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.video-info .video-meta {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.video-info .video-description {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    display: block;
    -webkit-line-clamp: unset;
}

/* ===== フッター ===== */
.footer {
    background-color: var(--text-primary);
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 60px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

/* ===== レスポンシブデザイン ===== */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 12px 0;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo i {
        font-size: 1.6rem;
    }

    .nav {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 8px 10px;
        flex: 0 1 auto;
    }

    .nav-link i {
        display: none;
    }

    .hero {
        padding: 40px 0;
    }

    .hero-title {
        font-size: 1.8rem;
        padding: 0 10px;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        padding: 0 10px;
    }

    .hero-stats {
        gap: 20px;
        padding: 0 10px;
    }

    .stat i {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .playlists-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .filter-section {
        padding: 20px 0;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
    }

    .search-group {
        width: 100%;
        min-width: auto;
    }

    .search-input {
        padding: 12px 16px 12px 45px;
        font-size: 1rem;
    }

    .videos-section {
        padding: 40px 0;
    }

    .video-card {
        border-radius: 10px;
    }

    .video-body {
        padding: 16px;
    }

    .video-title {
        font-size: 1.1rem;
    }

    .modal-content {
        margin: 20px 10px;
        border-radius: 10px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .video-player iframe {
        height: 220px;
    }

    .footer {
        padding: 30px 0;
        margin-top: 40px;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.4rem;
    }

    .logo span {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav {
        gap: 4px;
    }

    .nav-link {
        font-size: 0.75rem;
        padding: 7px 8px;
    }

    .hero {
        padding: 30px 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-stats {
        flex-direction: row;
        justify-content: space-around;
        gap: 15px;
    }

    .stat {
        flex: 1;
    }

    .stat i {
        font-size: 1.6rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .section-header {
        margin-bottom: 30px;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .section-subtitle {
        font-size: 0.85rem;
    }

    .playlist-body {
        padding: 18px;
    }

    .playlist-title {
        font-size: 1.2rem;
    }

    .video-title {
        font-size: 1rem;
    }

    .video-description {
        font-size: 0.85rem;
    }

    .modal-content {
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .video-player iframe {
        height: 200px;
    }

    .play-button {
        width: 60px;
        height: 60px;
    }

    .play-button i {
        font-size: 1.5rem;
    }
}