/* Custom styles for the video sharing platform */

:root {
    --bs-primary: #1E88E5;
    --bs-primary-rgb: 30, 136, 229;
}

body {
    padding-bottom: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Theme specific styles - will be applied based on data-bs-theme attribute */
html[data-bs-theme="light"] {
    --card-bg: #ffffff;
    --card-header-bg: #f8f9fa;
    --body-bg: #f4f4f4;
    --text-color: #333333;
    --border-color: rgba(0, 0, 0, 0.125);
    --navbar-bg: #ffffff;
    --nav-panel-bg: #ffffff;
    --input-bg: #f8f9fa;
    --video-container-bg: #000000; /* Always black for proper video display */
    --tab-bg: #f8f9fa;
    --active-tab-bg: #1e88e5;
    --active-tab-color: #ffffff;
    --accent-color: #1e88e5;
    --form-bg: #f8f9fa;
    --upload-area-bg: #ffffff;
}

/* Direct overrides for light mode */
html[data-bs-theme="light"] body {
    background-color: #f4f4f4;
    color: #333333;
}

html[data-bs-theme="light"] .card {
    background-color: #ffffff;
}

html[data-bs-theme="light"] .list-group-item {
    background-color: #f8f9fa;
    color: #333333;
}

html[data-bs-theme="light"] .tab-pane {
    background-color: #f8f9fa;
    color: #333333;
}

html[data-bs-theme="light"] .upload-area {
    background-color: #f8f9fa;
    color: #333333;
}

html[data-bs-theme="light"] .nav-link {
    color: #1e88e5;
}

html[data-bs-theme="light"] .nav-link:hover {
    color: #1565c0;
}

html[data-bs-theme="light"] .form-control,
html[data-bs-theme="light"] .input-group-text {
    background-color: #f8f9fa;
    color: #333333;
}

html[data-bs-theme="light"] .form-control:focus {
    background-color: #f8f9fa;
    color: #333333;
}

html[data-bs-theme="dark"] {
    --card-bg: #1e2124;
    --card-header-bg: #141618;
    --body-bg: #121212;
    --text-color: #e5e5e5;
    --border-color: rgba(255, 255, 255, 0.125);
    --navbar-bg: #141618;
    --nav-panel-bg: #1e2124;
    --input-bg: #2c2f33;
    --video-container-bg: #000000;
    --tab-bg: #1e2124;
    --active-tab-bg: #1e88e5;
    --active-tab-color: #ffffff;
    --accent-color: #1e88e5;
    --form-bg: #2c2f33;
    --upload-area-bg: #2c2f33;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
}

.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

.card-header {
    background-color: var(--card-header-bg);
    border-color: var(--border-color);
}

.list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.video-main-container {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.video-card .card {
    background-color: var(--card-bg);
}

/* Navbar styling handled by theme-specific selectors */

.form-control, .input-group-text {
    background-color: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.form-control:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
}

/* Consistent button styling */
.btn-primary {
    background-color: #1e88e5 !important;
    border-color: #1e88e5 !important;
}

.btn-outline-primary {
    color: #1e88e5 !important;
    border-color: #1e88e5 !important;
}

.btn-outline-primary:hover {
    background-color: rgba(30, 136, 229, 0.1) !important;
}

.nav-link.active {
    color: #1e88e5 !important;
}

.video-thumbnail {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
    border-radius: 5px;
}

.video-card {
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
}

.upload-area {
    border: 2px dashed var(--bs-border-color);
    border-radius: 5px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s;
    background-color: var(--upload-area-bg);
    color: var(--text-color);
}

.upload-area:hover {
    border-color: var(--accent-color);
    background-color: rgba(30, 136, 229, 0.05);
}

.upload-area.highlight {
    border-color: var(--accent-color);
    background-color: rgba(30, 136, 229, 0.1);
}

.url-input-group {
    margin-bottom: 20px;
}

#video-player,
.streamable-player {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
    display: block;
    background-color: #000;
    box-shadow: none;
    object-fit: contain; /* Maintain aspect ratio */
    border-radius: 10px; /* Add corner radius to video */
}

/* For vertical videos (portrait) in the appropriate container */
.video-wrapper[data-is-vertical="true"] #video-player,
.video-wrapper[data-is-vertical="true"] .streamable-player {
    max-height: 80vh;
    width: auto; /* Width is auto to respect the aspect ratio */
    height: 100%; /* Height fills the container */
}

/* Fix letterboxing */
#video-container {
    width: 100%;
    background-color: transparent; /* Changed to transparent */
    position: relative;
    padding: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    border-radius: 10px; /* Add corner radius to container */
}

/* This container wraps around the actual player and controls */
.video-wrapper {
    position: relative;
    display: inline-block;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 100%;
    transition: width 0.3s ease;
}

/* Special styling for vertical videos */
.video-wrapper[data-is-vertical="true"] {
    max-height: 80vh;
    margin: 0 auto;
    border-radius: 10px;
}

#video-container video {
    display: block;
    max-height: 80vh;
    border-radius: 10px; /* Add corner radius to video */
}

.video-info {
    margin-top: 20px;
}

.video-title {
    margin-bottom: 10px;
}

.video-description {
    white-space: pre-line;
    margin-bottom: 20px;
}

.description-container {
    position: relative;
}

.description-preview {
    position: relative;
    overflow: hidden;
}

.description-full {
    white-space: pre-line;
}

.fade-overlay {
    display: none;
}

html[data-bs-theme="light"] .fade-overlay {
    background: linear-gradient(rgba(255,255,255,0), var(--body-bg)) !important;
}

html[data-bs-theme="dark"] .fade-overlay {
    background: linear-gradient(rgba(0,0,0,0), var(--body-bg)) !important;
}

.share-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--bs-border-color);
}

.video-metadata {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.video-status {
    margin-bottom: 20px;
}

/* Tab navigation styling - Streamable style */
.nav-tabs {
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
    background-color: transparent;
    display: flex;
}

.nav-tabs .nav-link {
    color: #1e88e5;
    background-color: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-right: 8px;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(30, 136, 229, 0.05);
    border-color: #e5e5e5 #e5e5e5 transparent;
}

.nav-tabs .nav-link.active {
    color: #333;
    background-color: #fff;
    border-color: #e5e5e5 #e5e5e5 #fff;
}

/* Special styling for upload tabs navigation */
.upload-nav {
    border-bottom: none;
}

.upload-nav .nav-link {
    border: 1px solid #e5e5e5;
    background-color: #f8f9fa;
}

.upload-nav .nav-link.active {
    background-color: #fff;
    border-color: #e5e5e5;
    color: #333;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 600;
}

/* Upload tabs styling */
#uploadTabs .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-color);
}

#uploadTabs .nav-link.active {
    color: #1e88e5;
}

#uploadTabs .nav-link i, 
#uploadTabs .nav-link svg {
    margin-right: 5px;
}

.tab-pane {
    background-color: var(--form-bg);
    border-radius: 0 0 5px 5px;
    padding: 20px;
    color: var(--text-color);
}

/* Drag and drop styles */
.dragging {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

/* Loading spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Video player buffering indicator */
.buffering-indicator {
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
}

/* HLS video container position */
/* Streamable-like player styles */
.video-main-container {
    padding: 0;
}

html[data-bs-theme="light"] header {
    background-color: white !important;
    border-bottom: 1px solid #eaeaea;
}

html[data-bs-theme="light"] .video-main-container {
    background-color: white;
    color: #212529;
}

html[data-bs-theme="dark"] header {
    background-color: #1a1d21 !important;
    border-bottom: 1px solid #2c2f33;
}

html[data-bs-theme="dark"] .video-main-container {
    background-color: #1a1a1a;
    color: #f0f0f0;
}

#video-container {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 80vh;
    background-color: transparent;
}

.video-control-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.video-player-controls {
    position: relative;
    height: 50px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.4) 80%, rgba(0,0,0,0) 100%);
    display: flex;
    align-items: center;
    padding: 0 15px;
}

#video-container:hover .video-control-wrapper {
    opacity: 1;
}

.custom-video-control {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 8px;
    margin-right: 10px;
    cursor: pointer;
    transition: color 0.2s;
}

.custom-video-control:hover {
    color: #1E88E5;
}

.video-progress-bar {
    position: relative;
    height: 8px;
    background-color: rgba(255,255,255,0.2);
    cursor: pointer;
    margin-bottom: 0;
    transition: height 0.2s;
}

.video-progress-bar:hover {
    height: 12px;
}

.video-progress-value {
    height: 100%;
    background-color: #1E88E5;
    width: 0%;
    transition: width 0.1s;
    position: relative;
}

/* Scrubber dot on hover */
.video-progress-bar:hover .video-progress-value::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #1E88E5;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Time preview on hover */
.video-time-preview {
    position: absolute;
    bottom: 20px;
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    transform: translateX(-50%);
    display: none;
    pointer-events: none;
}

.video-progress-bar:hover .video-time-preview {
    display: block;
}

.time-display {
    color: white;
    font-size: 0.9rem;
    margin-left: 10px;
    margin-right: auto;
}

.video-fullscreen-btn {
    margin-left: 5px;
}

/* Volume slider */
.volume-container {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 2px;
    cursor: pointer;
    margin-left: 5px;
    position: relative;
    display: none;
}

.volume-container:hover .volume-slider {
    display: block;
}

.volume-level {
    height: 100%;
    background-color: #1E88E5;
    border-radius: 2px;
    width: 100%;
}

/* Speed control */
.speed-container {
    position: relative;
    margin-left: 5px;
}

.speed-button {
    background: none;
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 8px;
}

.speed-dropdown {
    position: absolute;
    bottom: 40px;
    right: 0;
    background-color: rgba(0,0,0,0.9);
    border-radius: 4px;
    padding: 8px 0;
    display: none;
    flex-direction: column;
    min-width: 120px;
    z-index: 10;
}

.speed-option {
    padding: 8px 15px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background-color 0.2s;
}

.speed-option:hover,
.speed-option.active {
    background-color: rgba(255,255,255,0.1);
}

.speed-option.active::before {
    content: "✓";
    margin-right: 5px;
}

/* Skip buttons */
.skip-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 1.2rem;
}

.skip-button:hover {
    color: #1E88E5;
}

/* PiP button */
.pip-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 0.9rem;
}

/* Profile page styles */
.list-group-item {
    background-color: var(--form-bg) !important;
    color: var(--text-color) !important;
}

/* Dashboard styles */
.dashboard-header {
    margin-bottom: 30px;
}

.video-actions {
    margin-top: 10px;
}

.thumbnail-container {
    overflow: hidden;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.video-thumbnail-link {
    display: block;
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-thumbnail-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumbnail-link:hover img {
    transform: scale(1.05);
}

/* Processing overlay */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.processing-content {
    padding: 15px;
}

/* Streamable-like cards */
.video-card .card {
    transition: transform 0.2s, box-shadow 0.2s;
    will-change: transform;
}

.video-card .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

.video-title {
    line-height: 1.3;
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Editable title styling */
.editable-title-container {
    position: relative;
    cursor: pointer;
    flex-grow: 1;
    max-width: 100%;
    overflow: hidden;
}

.video-title-text {
    padding: 0.25rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.editable-title-container:hover .video-title-text {
    border-color: #ddd;
    background-color: #f9f9f9;
}

.video-title-input {
    width: 100%;
    font-weight: 500;
    line-height: 1.3;
}

/* Share link styling */
.share-link-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.video-link {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e88e5;
    text-decoration: none;
}

/* Improved buttons */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Responsive fixes */
@media (max-width: 768px) {
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
    }
    
    .upload-area {
        padding: 15px;
    }
}
