/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
}

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

/* Header */
header {
    background: #2c3e50;
    border-bottom: 1px solid #ddd;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.made-by-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.made-by-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.made-by {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-style: italic;
}

.website-main-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.website-main-link:hover {
    background: linear-gradient(135deg, #3498db, #1abc9c);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.website-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.website-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.website-brand {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.website-subtitle {
    color: #ffffff;
    font-size: 0.8rem;
    font-style: italic;
    opacity: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

header h1 {
    color: #fff;
    margin: 0;
    font-size: 2.5rem;
    font-weight: 300;
}

.header-right {
    display: flex;
    align-items: center;
}

.app-navigation {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    color: white;
}

.nav-emoji {
    font-size: 1.2rem;
}

.nav-text {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Specialfärger för varje app */
.n1-btn:hover {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: #e74c3c;
}

.alien-btn:hover {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border-color: #9b59b6;
}

.nxt-btn:hover {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-color: #3498db;
}

.contact-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-style: italic;
}

/* Main container with sidebar layout */
.main-container {
    display: flex;
    min-height: calc(100vh - 120px);
    max-width: 1400px;
    margin: 0 auto;
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 120px;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.sidebar-header h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 500;
}

.category-search input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.3s ease;
}

.category-search input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 10px rgba(44, 62, 80, 0.1);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.sidebar-loading,
.sidebar-error {
    padding: 2rem 1.5rem;
    text-align: center;
    color: #2c3e50;
}

.spinner-small {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2c3e50;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.sidebar-error button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Categories list */
.categories-list {
    padding: 0;
}

.category-section {
    margin-bottom: 1rem;
}

.category-section-title {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.category-items {
    background: white;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.category-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
    border-left: 3px solid #2c3e50;
}

.category-item.active {
    background: #e9ecef;
    border-left: 3px solid #2c3e50;
    font-weight: bold;
    color: #2c3e50;
}

.category-name {
    font-size: 0.9rem;
    flex: 1;
}

.category-count {
    background: #e9ecef;
    color: #2c3e50;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #f5f5f5;
}

/* Welcome view */
.welcome-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.welcome-content {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

.welcome-content h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 300;
}

.welcome-content p {
    color: #636e72;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.welcome-stat {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.welcome-stat .number {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
}

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

/* Content View */
.content-view {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

#contentTitle {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 500;
    margin: 0;
}

.content-info {
    color: #636e72;
    font-weight: 500;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.controls input,
.controls select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
    color: #333;
}

.controls input:focus,
.controls select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 10px rgba(44, 62, 80, 0.1);
}

/* Content grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.content-item {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #2c3e50;
    border: 1px solid #f0f0f0;
}

.content-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #2c3e50;
}

/* Channel-specific styling */
.channel-item {
    padding: 1.25rem;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.channel-logo {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 2px solid #f0f0f0;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ändrat från 'cover' till 'contain' för att bevara aspekt-ratio */
    object-position: center;
    border-radius: 6px; /* Mindre border-radius eftersom parent har overflow hidden */
    background: white; /* Vit bakgrund för genomskinliga logoer */
    padding: 2px; /* Lite padding för luftighet */
    transition: transform 0.2s ease, opacity 0.3s ease;
}

/* Hover-effekt för logoer */
.channel-logo img:hover {
    transform: scale(1.05);
}

/* Loading state för logoer */
.channel-logo img[src=""] {
    opacity: 0;
}

.channel-logo img.loading {
    opacity: 0.5;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 2s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Fallback för misslyckade logoer */
.channel-logo img.error {
    display: none;
}

/* GitHub logo debugging */
.channel-logo img[src*="raw.githubusercontent.com"] {
    border: 2px solid #f39c12;
}

.channel-logo img[src*="raw.githubusercontent.com"].error {
    border: 2px solid #e74c3c;
    display: block;
    opacity: 0.3;
}

.channel-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 1;
}

/* Dölj placeholder när img laddas korrekt */
.channel-logo img:not(.error) + .channel-placeholder {
    display: none;
}

/* Olika storlekar för olika typer av content */
.channel-logo.large {
    width: 80px;
    height: 80px;
}

.channel-logo.small {
    width: 45px;
    height: 45px;
}

.channel-logo.small .channel-placeholder {
    font-size: 1rem;
}

/* Responsiv logo-hantering */
@media (max-width: 768px) {
    .channel-logo {
        width: 50px;
        height: 50px;
    }
    
    .channel-logo.large {
        width: 60px;
        height: 60px;
    }
    
    .channel-placeholder {
        font-size: 1.2rem;
    }
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
}

.channel-metadata {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.type-badge {
    background: #2c3e50;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    display: inline-block;
    font-weight: bold;
    text-transform: uppercase;
}

.quality-badge {
    background: #00b894;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    display: inline-block;
    font-weight: bold;
}

.channel-details {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.detail-item {
    color: #636e72;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.content-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.content-item .type-badge {
    background: #2c3e50;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.content-item .quality {
    color: #00b894;
    font-weight: bold;
    font-size: 0.9rem;
}

.content-item .url {
    color: #636e72;
    font-size: 0.8rem;
    word-break: break-all;
    margin-top: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.pagination button:hover:not(:disabled) {
    background: #34495e;
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.2);
}

.pagination button:disabled {
    background: #ddd;
    cursor: not-allowed;
    color: #999;
    opacity: 0.6;
}

.pagination button:not(:disabled) {
    cursor: pointer;
}

.pagination .current-page {
    background: #f8f9fa;
    color: #2c3e50;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    font-weight: bold;
    border: 1px solid #2c3e50;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 3rem;
    color: #2c3e50;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c3e50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error message */
.error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    margin: 2rem 0;
}

.error button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        max-height: 300px;
    }
    
    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .welcome-content {
        padding: 2rem;
        margin: 1rem;
    }
    
    .welcome-content h2 {
        font-size: 1.5rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-stats {
        grid-template-columns: 1fr;
    }
}

/* Responsiv header */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-left {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .made-by {
        font-size: 0.8rem;
        padding: 0.25rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .app-navigation {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-btn {
        min-width: 80px;
        justify-content: center;
    }
}

/* Scrollbar styling för sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
} 