/* Modern, responsive styling for Twitch Clip Viewer */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #9146ff;
    --primary-dark: #772ce8;
    --bg-color: #0e0e10;
    --surface-color: #18181b;
    --text-color: #efeff1;
    --text-secondary: #adadb8;
    --border-color: #3a3a3d;
    --error-color: #e91916;
    --success-color: #00d9ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

/* Index page styles */
.index-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.index-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.index-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.input-form {
    width: 100%;
    max-width: 600px;
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.input-form input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s;
}

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

.input-form button {
    padding: 12px 24px;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.input-form button:hover {
    background-color: var(--primary-dark);
}

.input-form button:active {
    transform: scale(0.98);
}

.examples {
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.examples code {
    background-color: var(--surface-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Clip viewer styles */
#clip-container {
    margin-top: 2rem;
}

.video-section {
    margin-bottom: 2rem;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.clip-video {
    width: 100%;
    height: auto;
    display: block;
}

/* Video controls (below video) */
.video-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

/* Quality selector */
.quality-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quality-selector label {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.quality-select {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 150px;
}

.quality-select:hover {
    border-color: var(--primary-color);
}

.quality-select:focus {
    border-color: var(--primary-color);
}

/* Download button */
.download-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s;
    cursor: pointer;
}

.download-button:hover {
    background-color: var(--primary-dark);
}

.metadata-section {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.clip-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metadata-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-size: 1.1rem;
    color: var(--text-color);
    word-break: break-word;
}

.metadata-value a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.metadata-value a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Thumbnails section */
.thumbnails-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.thumbnails-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.thumbnail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.thumbnail-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.thumbnail-image:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Thumbnail popup */
.thumbnail-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-popup.active {
    opacity: 1;
}

.thumbnail-popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.thumbnail-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2.5rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    line-height: 1;
}

.thumbnail-popup-close:hover {
    color: var(--primary-color);
}

.thumbnail-popup-label {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
}

.thumbnail-popup-image {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.error {
    text-align: center;
    padding: 3rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.error h2 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-dark);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .index-container h1 {
        font-size: 2rem;
    }
    
    .input-form {
        flex-direction: column;
    }
    
    .input-form button {
        width: 100%;
    }
    
    .metadata-grid {
        grid-template-columns: 1fr;
    }
    
    .thumbnails-grid {
        grid-template-columns: 1fr;
    }
    
    .clip-title {
        font-size: 1.5rem;
    }
    
    .metadata-section {
        padding: 1.5rem;
    }
}

/* Web archive compatibility */
/* Ensure all content is accessible to crawlers */
a {
    color: var(--primary-color);
}

img {
    max-width: 100%;
    height: auto;
}

/* Print styles for archiving */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .video-wrapper {
        page-break-inside: avoid;
    }
}
