/* Container and Layout */
.settings-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #3A3C41;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1;
    margin-top: 0;
    padding-top: 5px;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: #EAEAEC;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.dropdown-content a:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-content a:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-content a:hover {
    background-color: #E5A00D;
    color: #282A2D;
}

/* Header Buttons */
.donate-button, .back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 8rem;
    height: 40px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    gap: 8px;
    white-space: nowrap;
}

.donate-button, .back-button {
    font-size: 1rem;
}

.donate-button i, .back-button svg {
    width: 20px;
    height: 20px;
}

.donate-button {
    background-color: #238636;
    color: #ffffff;
    transition: background-color 0.2s;
}

.donate-button:hover {
    background-color: #2ea043;
}

.donate-button i, .back-button i {
    font-size: 1.25rem;
}

.donate-button i {
    font-size: 10px !important;
    width: auto !important;
    height: auto !important;
}

.back-button {
    background-color: #E5A00D;
    color: #282A2D;
    transition: background-color 0.2s;
    padding-left: 8px;
    padding-right: 12px;
}

.back-button:hover {
    background-color: #F8D68B;
}

.settings-header h1 {
    margin: 0;
    color: #EAEAEC;
    font-size: 2rem;
}

/* Tabs */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid #3A3C41;
    padding-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

.tab {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #EAEAEC;
    padding: 10px 18px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: #F8D68B;
}

.tab.active {
    background-color: transparent;
    color: #E5A00D;
    border-bottom: 3px solid #E5A00D;
}

/* Settings Sections */
.settings-section {
    background-color: #3A3C41;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.settings-section h2 {
    color: #EAEAEC;
    margin: 0 0 24px 0;
    font-size: 1.5rem;
}

.setting-field {
    margin-bottom: 24px;
}

.setting-field:last-child {
    margin-bottom: 0;
}

.setting-field label {
    display: block;
    color: #EAEAEC;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Enhance separation for standard setting fields (not in a grid) */
.settings-section:not(.general-features-section) > .setting-field {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #4A4C51;
}

.settings-section:not(.general-features-section) > .setting-field:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Inputs */
.setting-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #5A5C61;
    background-color: #212326;
    color: #EAEAEC;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.95rem;
}

.setting-input,
.env-override,
.current-config {
    width: calc(100% - 2px);  
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

.setting-input:focus {
    border-color: #E5A00D;
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 160, 13, 0.25);
}

/* Toggle Switch */
.toggle {
    width: 50px;
    height: 24px;
    background-color: #4A4C51;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 4px;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #EAEAEC;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle.active {
    background-color: #E5A00D;
}

.toggle.active::after {
    transform: translateX(26px);
}

.toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Configuration Buttons */
.discover-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12rem;
    gap: 8px;
    background-color: #E5A00D;
    color: #282A2D;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s, transform 0.1s ease-out;
    margin-bottom: 16px;
    height: 35px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.discover-button:hover {
    background-color: #F8D68B;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

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

/* Configuration Display */
.current-config {
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 12px;
    margin-top: 16px;
}

.config-item {
    color: #9CA3AF;
    margin: 4px 0;
}

/* Environment Override Notice */
.env-override {
    background-color: rgba(229, 160, 13, 0.1);
    border-left: 3px solid #E5A00D;
    padding: 8px 12px;
    margin-top: 4px;
    border-radius: 0 4px 4px 0;
    font-size: 0.9em;
    color: #E5A00D;
    box-sizing: border-box;
}

/* Messages - Fixed Position */
.error-message, .success-message, .info-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 16px;
    border-radius: 4px;
    color: white;
    z-index: 1001;
    min-width: 300px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.error-message {
    background-color: #B91C1C;
}

.success-message {
    background-color: #059669;
}

.info-message {
    background-color: #0E7490;
    color: #EAEAEC;
}

/* Trakt Integration Styles */
.trakt-connect-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ED1C24;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

/* General Features Section Grid Layout */
.general-features-section .fields-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.general-features-section .fields-grid-container > .setting-field {
    margin-bottom: 0;
    background-color: #282A2D;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #4A4C51;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.general-features-section .fields-grid-container > .setting-field label {
    margin-bottom: 12px;
}

.general-features-section .fields-grid-container > .setting-field .setting-description {
    margin-bottom: 12px;
    flex-grow: 1;
}

.general-features-section .fields-grid-container > .setting-field .toggle {
    margin-top: auto;
}

@media (max-width: 768px) {
    .general-features-section .fields-grid-container {
        grid-template-columns: 1fr;
    }
}

.trakt-connect-button:hover {
    background-color: #FF2D35;
    transform: translateY(-1px);
}

.trakt-connect-button.connected {
    background-color: #2ea043;
}

.trakt-connect-button.connected:hover {
    background-color: #3fb950;
}

.trakt-connect-button.loading {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.trakt-connect-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.trakt-connect-button i {
    font-size: 1.1em;
}

.trakt-confirm-dialog .dialog-note {
    color: #EAEAEC;
    font-size: 0.9em;
    margin-top: 16px;
    margin-bottom: 16px;
    display: flex; 
    align-items: center;
    gap: 8px; 
    opacity: 0.9; 
    line-height: 1.4;
}

.trakt-confirm-dialog .dialog-note i {
    color: #E5A00D;
    font-size: 1.1em;
}

/* Dialog Styles */
.trakt-confirm-dialog, .appletv-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-content {
    background-color: #3A3C41;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
}

.dialog-content h3 {
    color: #EAEAEC;
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dialog-content p {
    color: #EAEAEC;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.dialog-buttons button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

/* Custom Modal for Prompts/Confirms */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.custom-modal-content {
    background-color: #3A3C41;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.custom-modal-content h3 {
    color: #EAEAEC;
    margin: 0 0 16px 0;
    font-size: 1.25rem;
}

.custom-modal-content p {
    color: #EAEAEC;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.custom-modal-input-group {
    margin-bottom: 16px;
}

.custom-modal-input-group label {
    display: block;
    color: #EAEAEC;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9em;
}

.custom-modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #5A5C61;
    background-color: #212326;
    color: #EAEAEC;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.custom-modal-input:focus {
    border-color: #E5A00D;
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 160, 13, 0.25);
}

.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.custom-modal-button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.custom-modal-button.primary {
    background-color: #E5A00D;
    color: #282A2D;
}
.custom-modal-button.primary:hover {
    background-color: #F8D68B;
}

.custom-modal-button.secondary {
    background-color: #4A4C51;
    color: #EAEAEC;
}
.custom-modal-button.secondary:hover {
    background-color: #5A5C61;
}
.custom-modal-button.danger {
    background-color: #DC2626;
    color: white;
}
.custom-modal-button.danger:hover {
    background-color: #EF4444;
}

.cancel-button {
    background-color: #4A4C51;
    color: #EAEAEC;
    border: none;
}

.cancel-button:hover {
    background-color: #5A5C61;
}

.manual-button {
    background-color: #3A3C41;
    color: #EAEAEC;
    border: 1px solid #4A4C51;
}

.manual-button:hover {
    border-color: #E5A00D;
}

.disconnect-button {
    background-color: #DC2626;
    color: white;
}

.disconnect-button:hover {
    background-color: #EF4444;
}

.submit-button {
    background-color: #E5A00D;
    color: #282A2D;
}

.submit-button:hover {
    background-color: #F8D68B;
}

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

.dialog-steps .step {
    transition: opacity 0.3s, color 0.3s;
}

.dialog-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #9CA3AF;
}

.dialog-separator::before,
.dialog-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #4A4C51;
}

.dialog-separator span {
    padding: 0 10px;
}

/* Device/TV Lists */
.device-list, .tv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.device-option, .tv-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.device-option:hover, .tv-option:hover {
    background: #3A3C41;
    border-color: #E5A00D;
}

.device-option i, .tv-option i {
    font-size: 24px;
    color: #E5A00D;
}

.device-details, .tv-details {
    flex: 1;
}

.device-name, .tv-name {
    font-weight: 600;
    color: #EAEAEC;
}

.device-info, .tv-info {
    font-size: 0.9em;
    color: #9CA3AF;
}

.device-model {
    font-size: 0.85em;
    color: #9CA3AF;
    margin-top: 2px;
}

/* Setup Messages */
.setup-message {
    background: rgba(229, 160, 13, 0.1);
    border-radius: 4px;
    padding: 16px;
    margin: 16px 0;
}

.setup-message i {
    color: #E5A00D;
    margin-right: 8px;
}

.setup-message ul {
    margin: 8px 0;
    padding-left: 24px;
    color: #9CA3AF;
}

.setup-message p {
    margin: 8px 0;
    color: #EAEAEC;
}

/* PIN Input Styles */
.pin-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pin-code {
    font-family: monospace;
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
    width: 120px;
    padding: 8px;
    background: #282A2D;
    border: 1px solid #4A4C51;
    color: #EAEAEC;
    border-radius: 4px;
}

/* Spinner Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.trakt-connect-button.loading i {
    animation: spin 1s linear infinite;
}

@media (max-width: 640px) {
   .settings-header {
       flex-direction: column;
       align-items: flex-start;
   }

   .header-controls {
       width: 100%;
       display: flex;
       justify-content: space-between;
       gap: 16px;
   }

   .header-controls .dropdown,
   .header-controls .dropdown .donate-button,
   .header-controls .back-button {
       width: auto !important;
       min-width: 0 !important;
       flex: 1 !important;
   }

   .header-controls .dropdown-content {
       width: 100% !important;
       min-width: 0 !important;
       max-width: none !important;
   }

   .discover-button {
       width: 100%;
   }

   .settings-section {
       padding: 16px;
   }

   .dialog-content {
       width: calc(100% - 32px);
       margin: 16px;
   }

    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .donate-button i {
        position: relative;
        top: 2px;
        display: flex;
        align-items: center;
    }
}

/* Utility Classes */
.hidden {
    display: none;
}

.plex-auth-button,
.fetch-libraries-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12rem;  
    gap: 8px;
    background-color: #E5A00D;
    color: #282A2D;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.plex-auth-button:hover,
.fetch-libraries-button:hover {
    background-color: #F8D68B;
}

.plex-auth-button:disabled,
.fetch-libraries-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.library-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 8px;
}

.library-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
}

.library-option:hover {
    background: rgba(229, 160, 13, 0.1);
    border-radius: 4px;
}

.library-option input[type="checkbox"] {
    accent-color: #E5A00D;
}

.pin-display {
    background: #282A2D;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.pin-code {
    font-family: monospace;
    font-size: 32px;
    letter-spacing: 4px;
    color: #E5A00D;
    font-weight: bold;
}

.pin-instructions {
    color: #9CA3AF;
    font-size: 0.9em;
    margin-top: 16px;
}

.jellyfin-auth-wrapper {
    margin-top: 16px;
}

.jellyfin-auth-wrapper .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}


.user-selector-wrapper {
    margin-top: 8px;
}

.user-select {
    max-height: 300px;
    overflow-y: auto;
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 8px;
    margin: 16px 0;
}

.user-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
}

.user-option:hover {
    background: rgba(229, 160, 13, 0.1);
    border-radius: 4px;
}

.user-option input[type="checkbox"] {
    accent-color: #E5A00D;
}

.user-option span {
    color: #EAEAEC;
}

/* Timezone Field Wrapper */
.timezone-field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Timezone Dialog Styles */
.timezone-dialog {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timezone-list {
    max-height: 300px;
    overflow-y: auto;
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 8px;
}

.timezone-option {
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    color: #EAEAEC;
}

.timezone-option:hover {
    background: rgba(229, 160, 13, 0.1);
}

.timezone-option.selected {
    background-color: #E5A00D;
    color: #282A2D;
}

/* Settings Disabled State */
.settings-disabled {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
    text-align: center;
    padding: 20px;
    color: #EAEAEC;
    max-width: 800px;
    margin: 0 auto;
}

.settings-disabled h1 {
    color: #E5A00D;
    margin-bottom: 20px;
    font-size: 2rem;
}

.settings-disabled p {
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 1.1rem;
}

.settings-disabled .back-button {
    margin-top: 32px;
}

/* Configuration Help Styles */
.config-help {
    width: 100%;
    text-align: left;
    background: #282A2D;
    padding: 24px;
    border-radius: 8px;
    margin: 24px 0;
    border: 1px solid #4A4C51;
}

.config-help p {
    color: #E5A00D;
    margin: 16px 0 8px 0;
    font-size: 1rem;
    text-align: left;
}

.config-help p:first-child {
    margin-top: 0;
}

.config-help pre {
    background: #3A3C41;
    padding: 16px;
    border-radius: 4px;
    margin: 8px 0;
    overflow-x: auto;
    color: #EAEAEC;
    font-family: monospace;
    font-size: 0.9rem;
    border: 1px solid #4A4C51;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .settings-disabled {
        min-height: calc(100vh - 80px);
        padding: 16px;
    }

    .settings-disabled h1 {
        font-size: 1.75rem;
    }

    .settings-disabled p {
        font-size: 1rem;
    }

    .config-help {
        padding: 16px;
        margin: 16px 0;
    }

    .config-help pre {
        padding: 12px;
        font-size: 0.8rem;
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}

/* Make back button consistent with other buttons in settings */
.settings-disabled .back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #E5A00D;
    color: #282A2D;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.settings-disabled .back-button:hover {
    background-color: #F8D68B;
}

.settings-disabled .back-button svg {
    width: 20px;
    height: 20px;
}

.setting-description {
    font-size: 0.9em;
    color: #EAEAEC;
    margin: 4px 0 8px 0;
    opacity: 0.8;
    line-height: 1.4;
}

.setting-description a {
    color: #E5A00D;
    text-decoration: none;
    transition: color 0.2s;
}

.setting-description a:hover {
    color: #F8D68B;
    text-decoration: underline;
}

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 400px;
}

.flash-message {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background-color: #fff;
    border-left: 4px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.flash-message.show {
    opacity: 1;
    transform: translateX(0);
}

.flash-message.error {
    border-left-color: #dc3545;
}

.flash-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.flash-content i {
    color: #dc3545;
    font-size: 1.2em;
}

.auth-buttons-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.auth-buttons-group .discover-button {
    flex: 1;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.server-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.server-option:hover {
    background: #f5f5f5;
}

.server-details {
    display: flex;
    flex-direction: column;
}

.server-name {
    font-weight: bold;
}

.server-url {
    font-size: 0.9em;
    color: #666;
}

.server-group {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.server-name {
    font-weight: bold;
    margin-bottom: 10px;
}

.connection-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.server-option:hover {
    background: #f5f5f5;
}

.connection-type {
    font-weight: 500;
}

.server-url {
    font-size: 0.9em;
    color: #666;
}

.connection-info {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.connection-info ul {
    margin: 5px 0 0 20px;
    padding: 0;
}

.connection-info li {
    margin: 5px 0;
    font-size: 0.9em;
}

/* Select Input Styles */
select.setting-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #4A4C51;
    background-color: #282A2D;
    color: #EAEAEC;
    border-radius: 4px;
    transition: border-color 0.2s;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 32px;
}

select.setting-input:focus {
    border-color: #E5A00D;
    outline: none;
}

select.setting-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #3A3C41;
}

select.setting-input option {
    background-color: #282A2D;
    color: #EAEAEC;
    padding: 8px;
}

/* TV Entry Styles */
.tv-entry {
    background-color: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.tv-entry:hover {
    border-color: #E5A00D;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.tv-name {
    color: #EAEAEC;
    font-weight: 600;
    font-size: 1.1em;
    white-space: nowrap;
}

.tv-title-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-type {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.env-override {
    font-size: 0.85em;
    color: #ffa500;
    white-space: nowrap;
    line-height: 1;
}

.tv-details {
    color: #9CA3AF;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.tv-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.tv-toggle-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tv-toggle-section label {
    color: #EAEAEC;
    min-width: 60px;
    font-size: 0.9em;
    margin: 0;  
    display: flex;  
    align-items: center;  
    line-height: 1;  
}

.tv-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s;
}

.tv-action.test {
    background-color: #E5A00D;
    color: #282A2D;
}

.tv-action.test:hover {
    background-color: #F8D68B;
}

.tv-action.edit {
    background-color: #4A4C51;
    color: #EAEAEC;
}

.tv-action.edit:hover {
    background-color: #5A5C61;
}

.tv-action.delete {
    background-color: #DC2626;
    color: white;
}

.tv-action.delete:hover {
    background-color: #EF4444;
}

.no-tvs {
    color: #9CA3AF;
    text-align: center;
    padding: 24px;
    background: #282A2D;
    border-radius: 4px;
    border: 1px dashed #4A4C51;
}

/* Add TV Button */
.add-tv-button {
    width: 12rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #E5A00D;
    color: #282A2D;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.add-tv-button:hover {
    background-color: #F8D68B;
}

.found-devices {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
}

/* Dialog Footer Styles */
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.dialog-footer button {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    background-color: #3A3C41;
    color: #EAEAEC;
    border: 1px solid #4A4C51;
    transition: all 0.2s;
}

.dialog-footer button:hover {
    border-color: #E5A00D;
}

/* TV Setup Form Styles */
.tv-setup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.tv-setup-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tv-setup-form label {
    color: #EAEAEC;
    font-size: 0.9em;
    font-weight: 500;
}

.scan-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0;
}

.manual-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tv-button-container {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.manage-blacklist-button {
    background-color: #4A4C51;
    color: #EAEAEC;
}

.manage-blacklist-button:hover {
    background-color: #5A5C61;
}

.blacklist-devices {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
}

.blacklist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    margin-bottom: 8px;
}

.blacklist-mac {
    color: #EAEAEC;
    font-family: monospace;
    font-size: 0.9em;
}

.remove-blacklist {
    background-color: #DC2626;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-blacklist:hover {
    background-color: #EF4444;
}

.no-blacklist {
    color: #9CA3AF;
    text-align: center;
    padding: 24px;
    background: #282A2D;
    border-radius: 4px;
    border: 1px dashed #4A4C51;
}

/* TV Selection Dialog Styles */
.device-info-block {
    display: flex;
    flex-direction: column;
    background: #2A2A2A;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.device-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.device-info {
    flex-grow: 1;
}

.device-info .device-name {
    color: #EAEAEC;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.device-info .device-meta {
    color: #9CA3AF;
    font-size: 0.9em;
    line-height: 1.6;
}

.device-actions {
    display: flex;
    gap: 8px;
}

.select-button {
    background-color: #E5A00D;
    color: #282A2D;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
}

.select-button:hover {
    background-color: #F8D68B;
}

.blacklist-button {
    background-color: #DC2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.blacklist-button:hover {
    background-color: #EF4444;
}

.device-warning {
    margin-top: 12px;
    padding: 8px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    font-size: 0.9em;
    line-height: 1.4;
}

.device-warning i {
    margin-right: 6px;
    color: #856404;
}

.device-warning a {
    color: #856404;
    text-decoration: underline;
    font-weight: 500;
}

.bottom-links {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    z-index: 100;
    pointer-events: none;
}

.download-badge, .version-label {
    pointer-events: auto;  
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    background-color: rgba(240, 246, 252, 0.1);
    border: 1px solid rgba(240, 246, 252, 0.1);
    border-radius: 6px;
    color: #FFFFFF;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.download-badge:hover, .version-label:hover {
    background-color: rgba(240, 246, 252, 0.1);
    border-color: rgba(240, 246, 252, 0.3);
}

.download-badge .apple-icon {
    color: #E5A00D;
}

.version-label {
    position: relative;
    z-index: 1;
}

@media (max-width: 640px) {
    .bottom-links {
        display: none;
    }
}

.changelog {
    max-height: 60vh;
    overflow-y: auto;
}

.changelog::-webkit-scrollbar {
    width: 8px;
}

.changelog::-webkit-scrollbar-track {
    background: #282A2D;
    border-radius: 4px;
}

.changelog::-webkit-scrollbar-thumb {
    background: #4A4C51;
    border-radius: 4px;
}

.changelog::-webkit-scrollbar-thumb:hover {
    background: #5A5C61;
}


.admin-required {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.admin-required i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.admin-required h3 {
    margin-bottom: 10px;
    font-size: 24px;
}

.admin-required p {
    font-size: 16px;
}

/* User Management Styles */
.user-management-wrapper {
    margin-top: 24px;
}

.users-container {
    background-color: #282A2D;
    border: 1px solid #4A4C51;
    border-radius: 4px;
    padding: 16px;
}

.user-notice {
    font-size: 0.9em;
    color: #9CA3AF;
    margin-bottom: 16px;
    padding: 8px 12px;
    background-color: rgba(229, 160, 13, 0.1);
    border-left: 3px solid #E5A00D;
    border-radius: 0 4px 4px 0;
}

.user-notice i {
    margin-right: 6px;
    color: #E5A00D;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
    list-style: none;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #3A3C41;
    border-radius: 4px;
    border: 1px solid #4A4C51;
    transition: border-color 0.2s;
}

.user-item:hover {
    border-color: #E5A00D;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #EAEAEC;
}

.admin-badge,
.service-type-badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

.admin-badge {
    background-color: #E5A00D;
    color: #282A2D;
}

.service-type-badge.local {
    background-color: #4A4C51;
    color: #EAEAEC;
}

.service-type-badge.plex {
    background-color: #e5a00d; 
    color: #282A2D;
}

.service-type-badge.jellyfin {
    background-color: #7b4697; 
    color: #ffffff;
}

.service-type-badge.emby {
    background-color: #52b54b; 
    color: #ffffff;
}

.user-meta {
    font-size: 0.85em;
    color: #9CA3AF;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-meta span {
    display: block;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.user-action {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1em;
    transition: color 0.2s;
}

.user-action:hover {
    color: #EAEAEC;
}

.user-action.delete:hover {
    color: #EF4444;
}

.loading-users, .no-users {
    text-align: center;
    color: #9CA3AF;
    padding: 20px;
}

/* Role Badge Styles */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    line-height: 1.4; 
}

.role-badge.admin {
    background-color: #DC2626; 
    color: white;
}

.role-badge.owner {
    background-color: #D97706; 
    color: white;
}

.role-badge.user {
    background-color: #4A4C51; 
    color: #EAEAEC;
}

/* Generic Settings Modal Styles */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75); 
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Reuse existing dialog content style but ensure it applies */
.settings-modal .dialog-content {
    background-color: #3A3C41;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}

/* Style input groups within the modal */
.settings-modal .input-group {
    margin-bottom: 16px; 
}

.settings-modal .input-group label {
    display: block;
    color: #EAEAEC;
    margin-bottom: 6px; 
    font-weight: 500;
    font-size: 0.9em;
}

.settings-modal .setting-input {
    width: 100%; 
    box-sizing: border-box; 
}

.settings-modal .error-message {
    padding: 10px 14px; 
    margin-bottom: 16px;
    font-size: 0.9em;
}

.settings-modal .dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px; 
}

.settings-modal .cancel-button,
.settings-modal .submit-button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
