:root {
    --primary-color: #6e5494;
    --secondary-color: #24292e;
    --accent-color: #f9826c;
    --background-color: #f6f8fa;
    --card-background: #ffffff;
    --text-color: #24292e;
    --border-color: #e1e4e8;
}

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

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

/* Accessibility class to visually hide elements while keeping them accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    margin-bottom: 1rem;
}

.site-logo {
    max-width: 100%;
    height: auto;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: var(--secondary-color);
    opacity: 0.8;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .input-section {
        flex-direction: row;
    }
    
    #github-url {
        flex: 1;
    }
}

#github-url {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#github-url:focus {
    border-color: var(--primary-color);
}

#generate-btn {
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#generate-btn:hover {
    background-color: #5a4579;
}

/* Featured Images Styles */
.featured-images-container {
    max-height: 500px;
    overflow: hidden;
    margin: 0 auto;
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    background-color: var(--card-background);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.featured-images-container h3 {
    margin-bottom: 1rem;
    text-align: center;
    color: var(--secondary-color);
}

.featured-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

/* New image selection system */
.image-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-preview {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.main-featured-image {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.thumbnail {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail.selected {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.hidden {
    display: none;
}

.split-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.left-panel, .right-panel {
    width: 100%;
}

/* Desktop styles */
@media (min-width: 992px) {
    .split-layout {
        flex-direction: row;
        align-items: stretch;
        height: 100%;
    }
    
    .left-panel {
        width: 40%;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        justify-content: center;
        height: 100%;
    }
    
    .right-panel {
        width: 60%;
        position: sticky;
        top: 2rem;
    }
    
    .preview-section {
        margin-top: 0;
    }
    
    #download-btn {
        margin-top: auto;
    }
}

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.preview-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
}

.preview {
    width: 100%;
    aspect-ratio: 9/16;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background-color: white;
    transition: background-color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.repo-card {
    width: 100%;
    height: fit-content;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Featured Image Container */
.featured-image-container {
    width: 100%;
    max-height: 40%;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.selected-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.repo-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.github-logo {
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.repo-title h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    word-break: break-word;
}

.repo-description {
    padding: 1.5rem;
    color: #586069;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow: hidden;
    max-height: 200px;
    overflow-y: auto;
}

.repo-description p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 0 15px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-icon {
    color: #586069;
}

.stat-value {
    font-weight: 600;
    color: #24292e;
}

.repo-footer {
    padding: 15px;
    border-top: 1px solid #e1e4e8;
    font-size: 14px;
    color: #586069;
}

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

.qrcode {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode img {
    max-height: 60px;
    width: auto;
}

.input-hint {
    font-size: 0.85rem;
    color: #6a737d;
}

.featured-images-container h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    color: #24292e;
}

.featured-images {
    display: flex;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    max-height: 50vh;
}

.featured-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.featured-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.featured-image.selected {
    border-color: #0366d6;
    box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.3);
}

#download-btn {
    padding: 0.5rem 1rem;
    background-color: #f6f8fa;
    color: #24292e;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#download-btn:hover {
    background-color: #e1e4e8;
}

#download-btn:disabled {
    background-color: #f6f8fa;
    color: #959da5;
    cursor: not-allowed;
    opacity: 0.7;
}

#download-btn svg {
    stroke: currentColor;
}

footer {
    margin-top: 3rem;
    text-align: center;
    color: #6a737d;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .input-section {
        flex-direction: column;
    }
    
    .preview-container {
        max-width: 300px;
    }
    
    .repo-header {
        padding: 1rem;
    }
    
    .repo-title h2 {
        font-size: 1rem;
    }
    
    .featured-image {
        width: 100px;
        height: 70px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .qrcode img {
        width: 50px;
        height: 50px;
    }
}
