/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* モダンしいたけカラーパレット */
    --primary-color: #4a3f35; /* リッチブラウン */
    --secondary-color: #8b7355; /* ウォームブラウン */
    --accent-color: #d4a574; /* ゴールデンブラウン */
    --success-color: #7cb342; /* フレッシュグリーン */
    --danger-color: #e64a19; /* コーラル */
    --warning-color: #fb8c00; /* アンバー */
    --background-color: #fafafa; /* クリーンホワイト */
    --card-background: #ffffff; /* ピュアホワイト */
    --text-color: #2d2d2d; /* ソフトブラック */
    --text-secondary: #757575; /* グレー */
    --border-color: #e0e0e0; /* ライトグレー */
    --shiitake-light: #f5f1ed; /* しいたけライト */
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(212, 165, 116, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(212, 165, 116, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

/* Section Styles */
.section {
    background: var(--card-background);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
}

.section:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Status Badge */
.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--text-secondary);
    color: white;
}

.status-badge.online {
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

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

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    position: relative;
}

.video-placeholder::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(212, 165, 116, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(212, 165, 116, 0.2) 0%, transparent 50%);
}

.placeholder-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.small-text {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Stream Info */
.stream-info {
    display: flex;
    gap: 2rem;
    justify-content: center;
    padding: 1.5rem;
    background: var(--shiitake-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

.info-item .label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-item .value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input,
.sort-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input {
    flex: 1;
}

.search-input:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.sort-select {
    min-width: 150px;
    background: white;
    cursor: pointer;
}

/* Buttons */
.refresh-btn,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.refresh-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.video-card-body {
    padding: 1rem;
}

.video-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* Error Message */
.error-message {
    background-color: #fee;
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 1rem;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--card-background);
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    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: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.video-player {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.video-info {
    background: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.video-info p {
    margin-bottom: 0.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .section {
        padding: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .filter-controls {
        flex-direction: column;
    }

    .stream-info {
        flex-direction: column;
        gap: 1rem;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Stream Controls */
.stream-controls {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--shiitake-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.control-label:hover {
    background: rgba(52, 152, 219, 0.1);
}

.control-label input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Time Range Controls */
.time-range-controls {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.time-input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.time-input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.time-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Info Section */
.info-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.info-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(212, 165, 116, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(212, 165, 116, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.info-section .section-header {
    border-bottom-color: rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.info-section .section-header h2 {
    color: white;
}

.info-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.info-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.info-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    margin-bottom: 1rem;
    opacity: 0.9;
}

.info-card ul {
    list-style: none;
    padding-left: 0;
}

.info-card ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-card ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4ade80;
    font-weight: bold;
}

/* Video Stream */
.video-stream {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 768px) {
    .control-group {
        flex-direction: column;
        gap: 1rem;
    }

    .time-range-controls {
        flex-direction: column;
    }

    .time-input-group {
        width: 100%;
    }

    .info-content {
        grid-template-columns: 1fr;
    }
}
