/* General Styles */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to bottom right, #e0eafc, #cfdef3);
    margin: 0;
    padding: 20px;
    color: #333;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 100px; /* Add space for fixed player */
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
}

#loading-screen.fade-out {
    opacity: 0;
}

#loading-screen.hidden {
    display: none;
}

/* Header Styles */
.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    color: #2c3e50;
    margin: 0;
    font-size: 2.5em;
    cursor: pointer;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.app-header h1:hover {
    color: #007bff;
}

.app-header h1 i {
    font-size: 0.9em;
}

.app-header .tagline {
    color: #666;
    margin: 10px 0;
}

.user-profile {
    margin-top: 10px;
    font-weight: 500;
    color: #666;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

#searchForm {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

#searchInput {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e1e1e1;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

#searchForm button {
    padding: 12px 25px;
    background: linear-gradient(to right, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#searchForm button:hover {
    background: linear-gradient(to right, #0056b3, #003d80);
    transform: translateY(-1px);
}

#searchForm button i {
    font-size: 14px;
}

/* Results Section */
.podcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 0;
    list-style: none;
    margin: 0;
}

.podcast-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.podcast-item:hover {
    transform: translateY(-5px);
}

.podcast-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.podcast-item h3 {
    margin: 15px;
    font-size: 1em;
    line-height: 1.4;
}

.podcast-item p {
    margin: 10px 15px;
    color: #666;
    font-size: 0.9em;
}

.play-button {
    margin: 15px;
    padding: 8px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: calc(100% - 30px);
}

.play-button:hover {
    background: #218838;
}

/* Player Section */
.player-section {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.player-section.hidden {
    transform: translateY(100%);
}

#youtube-player {
    display: none; /* Hide the actual YouTube player */
}

.mini-player {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    cursor: pointer;
}

.mini-player-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 15px;
}

.mini-player-info img {
    width: 50px;
    height: 50px;
    border-radius: 5px;
    object-fit: cover;
}

.track-details {
    flex: 1;
    min-width: 0; /* Enable text truncation */
}

.track-details h3 {
    margin: 0;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-details p {
    margin: 5px 0 0;
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.control-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.main-control {
    background: #007bff;
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-control:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.progress-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    position: relative;
}

.progress-bar-container {
    flex: 1;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: visible;
    position: relative;
    cursor: pointer;
    margin: 0 10px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 100%;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    cursor: pointer;
}

/* Progress Track */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #007bff 0%, #007bff var(--progress, 0%), #e0e0e0 var(--progress, 0%));
    border-radius: 2px;
    cursor: pointer;
    border: none;
}

/* Progress Thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    border: 3px solid #ffffff;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

/* Hover and Active states */
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.3);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    background: #0056b3;
}

/* Progress bar container hover effect */
.progress-bar-container:hover {
    height: 6px;
    transition: height 0.2s ease;
}

.progress-bar-container:hover input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
}

/* Time labels */
#current-time,
#total-time,
#full-current-time,
#full-total-time {
    font-size: 0.8em;
    color: #666;
    min-width: 45px;
    font-family: monospace;
    font-weight: 500;
}

/* Full player specific styles */
.full-player .progress-bar-container {
    height: 6px;
    margin: 0 15px;
}

.full-player input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -7px;
}

.full-player input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
}

/* Add this to your existing JavaScript to update progress color */
.progress-bar-container {
    --progress: 0%;
}

/* History Section */
.history-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.history-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.history-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.history-item:hover {
    transform: translateY(-3px);
}

.history-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.history-details {
    padding: 10px;
}

.history-title {
    font-size: 0.9em;
    margin-bottom: 5px;
    line-height: 1.4;
}

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

.empty-history {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #666;
}

/* Loading and Error Messages */
.loading-message,
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 1.1em;
}

.loading-message {
    background: #e8f5ff;
    color: #0056b3;
    border: 1px solid #b3d7ff;
}

.error-message {
    background: #fff2f2;
    color: #dc3545;
    border: 1px solid #ffb3b3;
}

.error-message i,
.loading-message i {
    margin-right: 8px;
}

/* URL Input Section */
.url-input-section,
.or-divider,
.url-input-container {
    display: none;
}

/* Full Player Styles */
.full-player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
}

.full-player.hidden {
    transform: translateY(100%);
}

.full-player:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
}

.full-player-header {
    padding: 20px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid #eee;
}

.minimize-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5em;
    color: #666;
    cursor: pointer;
    padding: 10px;
}

.full-player-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    overflow-y: auto;
}

.full-player-artwork {
    width: 100%;
    max-width: 300px;
    margin-bottom: 30px;
}

.full-player-artwork img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.full-player-info {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 400px;
}

.full-player-info h2 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    line-height: 1.4;
}

.full-player-info p {
    margin: 0;
    color: #666;
}

.full-player-progress {
    width: 100%;
    max-width: 400px;
    margin-bottom: 30px;
}

.time-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9em;
}

.full-player-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.full-player-controls .control-button {
    font-size: 1.2em;
}

.full-player-controls .main-control {
    font-size: 1.8em;
    width: 60px;
    height: 60px;
}

/* Skip button animations */
#rewind, #forward, #full-rewind, #full-forward {
    transition: transform 0.2s ease;
}

#rewind:active, #full-rewind:active {
    transform: translateX(-2px);
}

#forward:active, #full-forward:active {
    transform: translateX(2px);
}

/* Time skip indicator */
.time-skip-indicator {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.time-skip-indicator.visible {
    opacity: 1;
}

/* Enhanced History Section */
.history-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.history-time, .history-ago {
    display: flex;
    align-items: center;
}

.history-time::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free';
    margin-right: 4px;
}

.history-ago::before {
    content: '\f1da';
    font-family: 'Font Awesome 6 Free';
    margin-right: 4px;
}

.history-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        margin-bottom: 120px; /* More space for player on mobile */
    }
    
    #searchForm {
        flex-direction: column;
    }
    
    .podcast-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .controls {
        flex-wrap: wrap;
    }
    
    .volume-container {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }

    .mini-player {
        padding: 10px 5px;
    }

    .mini-player-info {
        padding: 0 10px;
    }

    .track-details h3 {
        font-size: 0.8em;
    }

    .track-details p {
        font-size: 0.7em;
    }

    .progress-bar {
        padding: 0 10px;
    }

    #current-time,
    #total-time {
        font-size: 0.7em;
        min-width: 40px;
    }

    .url-input-container {
        flex-direction: column;
    }

    #playUrlButton {
        width: 100%;
    }

    .full-player-content {
        padding: 20px;
    }

    .full-player-artwork {
        max-width: 250px;
    }

    .full-player-controls .main-control {
        width: 50px;
        height: 50px;
    }
}
