/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-bg);
}

/* コンテナ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.site-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.main-nav a:hover {
    background: var(--light-bg);
}

/* ユーザーメニュー */
.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-button:hover {
    background: var(--light-bg);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: var(--light-bg);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

.premium-link {
    color: var(--warning-color) !important;
    font-weight: bold;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-login {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-register {
    background: var(--primary-color);
    color: white;
}

/* 検索バー */
.search-section {
    margin: 30px 0;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

/* カテゴリフィルター */
.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.category-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.category-btn:hover, .category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 動画グリッド */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.video-link {
    text-decoration: none;
    color: inherit;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: var(--dark-bg);
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumbnail {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
}

.premium-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--warning-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-uploader {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.video-stats {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

.video-ratings {
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    gap: 15px;
}

/* ページネーション */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 40px 0;
}

.pagination-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.pagination-btn:hover, .pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 動画再生ページ */
.video-page {
    max-width: 1280px;
    margin: 30px auto;
}

.video-player-section {
    background: black;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-player {
    width: 100%;
    max-height: 720px;
}

.premium-required {
    padding: 60px 20px;
    text-align: center;
    color: white;
}

.video-details {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.video-stats-row {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
}

.video-actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--border-color);
}

.btn-action.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.video-uploader-info {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.uploader-avatar span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.video-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* コメントセクション */
.comments-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.comment-form {
    margin: 20px 0;
}

.comment-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 10px;
}

.comments-list {
    margin-top: 30px;
}

.comment {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-avatar span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: white;
    font-weight: bold;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.comment-username {
    font-weight: 600;
}

.comment-date {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 認証ページ */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.auth-box h1 {
    margin-bottom: 20px;
    text-align: center;
}

.auth-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

/* アラート */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* アップロード者/管理者ページ */
.uploader-page, .admin-page {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin: 30px 0;
}

.sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.sidebar-nav h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--light-bg);
    color: var(--primary-color);
}

.main-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
}

/* 統計カード */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--primary-color);
    font-size: 13px;
    text-decoration: none;
}

.stat-pending {
    border-color: var(--warning-color);
}

.stat-approved {
    border-color: var(--success-color);
}

.stat-rejected {
    border-color: var(--danger-color);
}

.stat-views, .stat-premium {
    border-color: var(--primary-color);
}

/* テーブル */
.table-responsive {
    overflow-x: auto;
}

.data-table, .video-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.data-table th, .video-table th,
.data-table td, .video-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th, .video-table th {
    background: var(--light-bg);
    font-weight: 600;
}

.table-thumbnail {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 10px;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* アップロードフォーム */
.upload-info {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 30px;
}

.upload-info p {
    margin: 5px 0;
    font-size: 14px;
}

/* ダッシュボードグリッド */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.dashboard-section {
    background: white;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
}

.dashboard-section h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

/* 承認待ち動画 */
.pending-videos-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.pending-video-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.video-preview {
    background: black;
}

.preview-player {
    width: 100%;
    max-height: 400px;
}

.video-details {
    padding: 20px;
}

.approval-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.reject-form {
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 6px;
}

/* フッター */
.site-footer {
    background: var(--dark-bg);
    color: white;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

/* メッセージ */
.no-videos, .no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .uploader-page, .admin-page {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .main-nav {
        flex-wrap: wrap;
    }
}