/* Basic Reset */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a1a1a;
    color: #ecf0f1;
}

/* Main application container using Flexbox */
#app, .app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Video player container */
.video-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    padding: 20px;
    box-sizing: border-box;
    position: relative; 
}

video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* --- Control Panel Styling --- */
.control-panel {
    width: 20%;
    max-width: 20%;
    min-width: 300px; 
    background-color: #2c3e50;
    padding: 25px;
    box-sizing: border-box;
    overflow-y: auto;
}

.control-panel h2 {
    margin-top: 0;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group {
    margin-bottom: 25px;
}

.control-group h3 {
    margin-bottom: 15px;
    color: #bdc3c7;
    font-size: 1em;
}

/* --- Individual Control Styles --- */

/* General Buttons, Selects, and Text Inputs */
.control-panel button, .control-panel select, .control-panel input[type="text"] {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #4a637c;
    border-radius: 5px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 16px;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.control-panel button {
    cursor: pointer;
    text-align: left;
}

.control-panel button:hover, .control-panel select:hover, .control-panel input:hover {
    background-color: #4a637c;
}

/* Header buttons (gear, arrow) */
.control-panel .header-button {
    background: transparent !important;
    border: none !important;
    padding: 5px !important;
    margin: 0 !important;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.control-panel .header-button:hover { background: rgba(255, 255, 255, 0.1) !important; }
.control-panel .header-button svg { width: 24px; height: 24px; fill: #ecf0f1; }


/* Action Sheet Styles */
.action-sheet {
    background-color: #34495e;
    border: 1px solid #4a637c;
    border-radius: 5px;
    padding: 15px;
    margin-top: 10px;
    margin-bottom: 25px;
}
.action-sheet h4 { margin-top: 0; margin-bottom: 15px; text-align: center; }
.action-sheet p { text-align: center; margin-bottom: 20px; color: #bdc3c7; }
.action-sheet label { display: block; margin-bottom: 3px; font-size: 0.9em; color: #bdc3c7; }
.action-sheet select, .action-sheet input[type="text"] {
    padding-top: 6px !important; padding-bottom: 6px !important; font-size: 14px; margin-bottom: 12px;
}
.action-buttons { display: flex; gap: 10px; margin-top: 5px; }
.control-panel .action-buttons button { flex: 1; text-align: center; font-weight: bold; margin-bottom: 0 !important; padding: 8px !important; font-size: 14px; }
.control-panel .action-button-save { background-color: #27ae60; border-color: #27ae60; }
.control-panel .action-button-save:hover { background-color: #2ecc71; }
.control-panel .action-button-cancel { background-color: #95a5a6; border-color: #95a5a6; }
.control-panel .action-button-cancel:hover { background-color: #bdc3c7; }
.control-panel .action-button-confirm { background-color: #c0392b; border-color: #c0392b; }
.control-panel .action-button-confirm:hover { background-color: #e74c3c; }


/* Provider Dropdown and Button Styles */
.provider-container { display: flex; align-items: center; gap: 8px; }
.provider-container select { flex: 1; min-width: 0; margin-bottom: 0 !important; padding-top: 6px !important; padding-bottom: 6px !important; }
.control-panel .add-button { flex-shrink: 0; width: 33px; height: 33px; padding: 0 !important; margin-bottom: 0 !important; font-size: 20px; font-weight: bold; text-align: center; line-height: 33px; }


/* Container for the row of tabs */
.tabs-container { display: flex; margin-bottom: 15px; gap: 5px; }
/* Individual tab button styling */
.control-panel .tab-button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; min-width: 0;           
    gap: 5px; padding: 8px 5px !important; margin-bottom: 0 !important; border-bottom: 3px solid transparent; 
    border-radius: 5px 5px 0 0 !important; background-color: #34495e !important; font-size: 10px;
}
/* Style for the currently active tab */
.control-panel .tab-button.active { background-color: #4a637c !important; border-bottom-color: #3498db; font-weight: bold; }
/* Style for the SVG icons within the tabs */
.control-panel .tab-button svg { width: 24px; height: 24px; fill: currentColor; }
.search-input { margin-bottom: 5px !important; background-color: #2c3e50; padding-top: 6px !important; padding-bottom: 6px !important; }

/* Scrollable List (DEPRECATED but kept for reference) */
.scrollable-list {
    height: 240px;
    border: 1px solid #4a637c;
    border-radius: 5px;
    overflow-y: scroll;
    background-color: #34495e;
}

.list-item {
    padding: 6px 15px; 
    cursor: pointer;
    border-bottom: 1px solid #4a637c;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background-color: #4a637c; }
.list-item.selected { background-color: #3498db; font-weight: bold; }

/* Miscellaneous buttons */
.misc-buttons-container {
    display: flex;
    gap: 8px;
}

.control-panel .misc-buttons-container button {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 13px;
    padding: 8px 5px !important;
    margin-bottom: 0 !important;
}

/* === Custom Dark Theme Scrollbar Styles for Media List === */
.scrollable-list, .custom-dropdown-menu {
  scrollbar-width: thin;
  scrollbar-color: #4a637c #34495e;
}
.scrollable-list::-webkit-scrollbar, .custom-dropdown-menu::-webkit-scrollbar {
  width: 10px;
}
.scrollable-list::-webkit-scrollbar-track, .custom-dropdown-menu::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 5px;
}
.scrollable-list::-webkit-scrollbar-thumb, .custom-dropdown-menu::-webkit-scrollbar-thumb {
  background-color: #4a637c;
  border-radius: 5px;
  border: 2px solid #34495e;
}
.scrollable-list::-webkit-scrollbar-thumb:hover, .custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background-color: #5a738c;
}

/* === Custom Dropdown Styles === */
.custom-dropdown {
    /* MODIFIED: Added position relative */
    position: relative;
}
.provider-container .custom-dropdown {
    flex-grow: 1; 
    min-width: 0; 
}

.custom-dropdown-toggle {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 6px 12px !important;
    margin-bottom: 0 !important;
}
.custom-dropdown-toggle .caret {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #ecf0f1;
    transition: transform 0.3s ease;
}
.custom-dropdown-toggle .caret.open {
    transform: rotate(180deg);
}
.custom-dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    background-color: #34495e;
    border: 1px solid #4a637c;
    border-radius: 5px;
    position: absolute;
    width: 100%;
    z-index: 1000;
    max-height: 250px; /* Increased max-height */
    overflow-y: auto;
}
.custom-dropdown-menu li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #4a637c;
}
.custom-dropdown-menu li:last-child {
    border-bottom: none;
}
.custom-dropdown-menu li:hover {
    background-color: #4a637c;
}
.custom-dropdown-menu li.selected {
    background-color: #3498db;
    font-weight: bold;
}

/* --- NEW: Styles for the search bar inside the dropdown --- */
.custom-dropdown-menu .search-item {
    padding: 5px;
    cursor: default;
    background-color: #34495e !important; /* Override hover */
    border-bottom: 2px solid #4a637c; /* Make separator stronger */
}
.custom-dropdown-menu .search-item .search-input {
    margin-bottom: 0 !important;
}


.custom-dropdown-menu .item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}
.custom-dropdown-menu .item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 15px;
}
.control-panel .custom-dropdown-menu .item-actions .action-icon {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 20px;
    height: 20px;
    opacity: 0; 
    transition: opacity 0.2s ease;
}
.custom-dropdown-menu li:hover .item-actions .action-icon {
    opacity: 1; 
}
.control-panel .custom-dropdown-menu .action-icon svg {
    width: 100%;
    height: 100%;
    fill: #ecf0f1;
}
.control-panel .custom-dropdown-menu .action-icon:hover svg {
    fill: #ffffff;
}

