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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    padding: 20px;
    color: white;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: #111111;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    color: white;
    padding: 25px 40px;
    border-bottom: 2px solid #222;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 2.2em;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 12px 24px;
    background: #1a1a1a;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    border: 2px solid #333;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-btn:hover {
    background: #2a2a2a;
    border-color: #555;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #000;
    border-color: white;
}

.search-section {
    padding: 40px;
    background: #111111;
    border-bottom: 1px solid #222;
}

.search-box {
    display: flex;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

#searchInput {
    flex: 1;
    padding: 18px 25px;
    font-size: 16px;
    border: 2px solid #333;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s;
    background: #1a1a1a;
    color: white;
}

#searchInput:focus {
    border-color: white;
    background: #222;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

#searchInput::placeholder {
    color: #666;
}

#searchBtn {
    padding: 18px 40px;
    font-size: 16px;
    background: white;
    color: #000;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.2);
    background: #f0f0f0;
}

#searchBtn:active {
    transform: translateY(0);
}

/* Page principale avec lecteur */
.main-content-player {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 40px;
    background: #111111;
}

.player-section-main {
    position: sticky;
    top: 20px;
    height: fit-content;
}

#player-container {
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
}

#player-placeholder {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    color: white;
    text-align: center;
    padding: 40px;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.placeholder-icon {
    font-size: 60px;
    opacity: 0.5;
}

.search-link-btn {
    padding: 15px 30px;
    background: white;
    color: #000;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 10px;
}

.search-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

#player {
    width: 100%;
    aspect-ratio: 16/9;
    display: block;
}

.video-info-main {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.video-info-main h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: white;
}

.video-info-main p {
    color: #aaa;
    font-size: 1em;
}

/* Historique */
.history-section {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 25px;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.history-header h2 {
    font-size: 1.5em;
    color: white;
}

.clear-btn {
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: #444;
}

.history-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #222;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    border: 2px solid transparent;
}

.history-item:hover {
    background: #2a2a2a;
    border-color: #444;
    transform: translateX(5px);
}

.history-item img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.history-info h4 {
    font-size: 0.95em;
    margin-bottom: 5px;
    color: white;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.history-channel {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 3px;
}

.history-date {
    color: #666;
    font-size: 0.8em;
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
}

.history-item:hover .remove-btn {
    opacity: 1;
}

.remove-btn:hover {
    background: rgba(255, 0, 0, 0.8);
}

.no-history {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* Page de recherche */
.results-container {
    padding: 40px;
    background: #111111;
}

#results-title {
    font-size: 1.8em;
    margin-bottom: 30px;
    color: white;
    font-weight: 500;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.video-card-search {
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.video-card-search:hover {
    transform: translateY(-5px);
    border-color: #444;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    opacity: 0;
    transition: all 0.3s;
}

.video-card-search:hover .play-overlay {
    opacity: 1;
}

.video-info-search {
    padding: 18px;
}

.video-info-search h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: white;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-info-search .channel {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.video-info-search .date {
    color: #666;
    font-size: 0.85em;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: #aaa;
    font-size: 1.1em;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.2em;
}

.error {
    color: #ff6b6b;
    padding: 20px;
    background: #2a1a1a;
    border-radius: 12px;
    border: 2px solid #ff6b6b;
    margin: 20px 0;
    line-height: 1.6;
}

/* Scrollbar personnalisée */
.history-list::-webkit-scrollbar,
.results-grid::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track,
.results-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb,
.results-grid::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.results-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content-player {
        grid-template-columns: 1fr;
    }

    .player-section-main {
        position: relative;
    }

    .history-section {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    header h1 {
        font-size: 1.6em;
    }

    .search-section {
        padding: 25px 20px;
    }

    .search-box {
        flex-direction: column;
    }

    .results-container {
        padding: 25px 20px;
    }

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

    .main-content-player {
        padding: 25px 20px;
    }

    .history-item {
        flex-direction: column;
    }

    .history-item img {
        width: 100%;
        height: auto;
    }
}
