/* Dark Mode Professional UI - Alta Video Camera Proxy */

/* CSS Variables for Dark Mode Color Palette */
:root {
    --bg-primary: #1E1E1E;
    --bg-secondary: #2D2D30;
    --border: #3C3C3C;
    --text-primary: #E0E0E0;
    --text-secondary: #999999;
    --accent-primary: #0E7AFE;
    --accent-primary-hover: #0A5FD9;
    --success: #4CAF50;
    --error: #F44336;
    --warning: #FF9800;
    --input-bg: #1E1E1E;
    --button-outline: #555555;
    --card-bg: #2D2D30;
    --hover-bg: #3C3C3C;
    --tab-active: #0E7AFE;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 24px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.nav-tab:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--tab-active);
    border-bottom-color: var(--tab-active);
    background: var(--bg-primary);
}

/* Main Layout */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left Sidebar - Available Devices */
.devices-sidebar {
    width: 220px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Device Search */
.device-search-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.device-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--button-outline);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.device-search-input::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.device-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Device List */
.device-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.device-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.device-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.device-item:hover {
    background: var(--hover-bg);
    border-color: var(--accent-primary);
}

.device-item.selected {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.device-item.proxy-active {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.device-item.proxy-active::before {
    content: "PROXY ACTIVE";
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--success);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-item.selected.proxy-active {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.device-name {
    font-size: 14px;
    font-weight: bold;
    color: inherit;
    flex: 1;
}

/* Device Status Dot */
.device-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    flex-shrink: 0;
}

.device-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.device-status-dot.offline {
    background: var(--error);
    box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
    font-size: 12px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.content-header {
    margin-bottom: 24px;
    text-align: center;
}

.content-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--tab-active);
    margin: 0;
}

/* Content Sections */
.content-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.content-section h2 {
    font-size: 16px;
    font-weight: bold;
    color: var(--tab-active);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Profile Controls - Smaller and more compact */
.profile-section {
    padding: 12px 20px;
}

.profile-controls {
    margin-bottom: 0;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.profile-row label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 100px;
}

.profile-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--button-outline);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    max-width: 250px;
}

.profile-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #45a049;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--button-outline);
}

.btn-outline:hover:not(:disabled) {
    background: var(--hover-bg);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Selected Profile Info */
.selected-profile-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    margin-top: 8px;
}

.selected-profile-info p {
    margin: 0;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 8px;
}

.selected-profile-info.has-profile p {
    color: var(--text-primary);
    font-style: normal;
}

.profile-detail {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    font-size: 8px;
}

.profile-detail strong {
    color: var(--text-primary);
    font-weight: bold;
}

/* Connection Status */
.connection-status {
    margin-bottom: 16px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.status-row label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 50px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--error);
}

.status-text {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

/* Connection Controls */
.connection-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Proxy Controls */
.proxy-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-row label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 80px;
}

.input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--button-outline);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-style: italic;
}

.input-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.proxy-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Status Messages */
.status-message {
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px 0;
    font-weight: bold;
    font-size: 14px;
    display: none;
    border: 1px solid transparent;
}

.status-message.success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.status-message.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--error);
    border-color: var(--error);
}

.status-message.warning {
    background-color: rgba(255, 152, 0, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.status-message.info {
    background-color: rgba(14, 122, 254, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 2vh auto;
    padding: 0;
    border-radius: 8px;
    width: clamp(400px, 80vw, 800px);
    max-height: 90vh;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: bold;
    color: var(--text-primary);
}

.close {
    color: var(--text-secondary);
    font-size: clamp(20px, 3vw, 28px);
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: clamp(14px, 2vw, 18px);
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: clamp(8px, 1.5vw, 12px) clamp(12px, 2vw, 16px);
    border: 1px solid var(--button-outline);
    border-radius: 4px;
    font-size: clamp(14px, 2vw, 18px);
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 8px 8px;
}

.modal-btn {
    padding: clamp(8px, 1.5vw, 12px) clamp(16px, 2.5vw, 24px);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: bold;
}

.modal-btn.primary {
    background: var(--accent-primary);
    color: white;
}

.modal-btn.secondary {
    background: var(--button-outline);
    color: var(--text-primary);
}

/* Profiles List */
.profiles-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: clamp(16px, 2.5vw, 24px) clamp(20px, 3vw, 32px);
    flex: 1;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(12px, 2vw, 18px);
    margin-bottom: clamp(8px, 1.5vw, 12px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.profile-item:hover {
    background: var(--hover-bg);
}

.profile-info h4 {
    margin: 0 0 clamp(4px, 1vw, 8px) 0;
    color: var(--text-primary);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: bold;
}

.profile-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: clamp(12px, 1.8vw, 16px);
}

.profile-actions {
    display: flex;
    gap: 6px;
}

.profile-action-btn {
    padding: clamp(6px, 1vw, 10px) clamp(8px, 1.5vw, 12px);
    font-size: clamp(12px, 1.8vw, 16px);
    font-weight: bold;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: clamp(50px, 8vw, 80px);
}

.profile-action-btn.edit {
    background: var(--warning);
    color: white;
}

.profile-action-btn.delete {
    background: var(--error);
    color: white;
}

.profile-action-btn:hover {
    opacity: 0.8;
}

.no-profiles {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: clamp(30px, 5vw, 50px);
    font-size: clamp(14px, 2vw, 18px);
}

/* Dark Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--button-outline);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hover-bg);
}

/* Loading Animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

button:disabled {
    animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .devices-sidebar {
        width: 150px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .profile-row,
    .connection-controls,
    .proxy-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .profile-row select {
        max-width: none;
    }
    
    .modal-content {
        width: 95vw;
        margin: 1vh auto;
    }
    
    .profile-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .profile-actions {
        align-self: stretch;
        justify-content: flex-end;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .modal-content {
        max-width: 900px;
    }
}

/* Focus States for Accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 1px;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    :root {
        --border: #666666;
        --text-secondary: #CCCCCC;
        --button-outline: #777777;
    }
}

/* Collapsible Section Styles */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
    margin: 0 0 16px 0;
    transition: all 0.2s ease;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.collapsible-header h2 {
    margin: 0;
    flex: 1;
}

.collapse-icon {
    font-size: 16px;
    color: var(--accent-primary);
    font-weight: bold;
    transition: transform 0.3s ease;
    margin-left: 8px;
}

.collapse-icon.expanded {
    transform: rotate(180deg);
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.collapsible-content.collapsed {
    display: none !important;
}