/* Favorites Panel Styles */

#favorites-panel {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    width: 450px;
    max-width: 90vw;
    max-height: 55vh;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#favorites-panel.hidden {
    transform: translate(-50%, -100%);
    pointer-events: none;
}

#favorites-panel:not(.hidden) {
    transform: translate(-50%, 0);
    pointer-events: all;
}

/* Mobile Phones (up to 768px) */
@media (max-width: 768px) {
    #favorites-panel {
        width: calc(100vw - 80px);
        max-width: calc(100vw - 80px);
        max-height: 45vh;
        left: 40px;
        transform: translate(0, -100%);
        border-radius: 0 0 16px 16px;
    }
    
    #favorites-panel.hidden {
        transform: translate(0, -100%);
    }
    
    #favorites-panel:not(.hidden) {
        transform: translate(0, 0);
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    #favorites-panel {
        width: calc(100vw - 60px);
        max-width: calc(100vw - 60px);
        max-height: 50vh;
        left: 30px;
        border-radius: 0 0 14px 14px;
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #favorites-panel {
        width: 500px;
        max-height: 58vh;
    }
}

/* Medium Desktops (1025px - 1399px) */
@media (min-width: 1025px) and (max-width: 1399px) {
    #favorites-panel {
        width: 550px;
        max-height: 55vh;
    }
}

/* Large Desktops (1400px+) */
@media (min-width: 1400px) {
    #favorites-panel {
        width: 600px;
        max-height: 50vh;
    }
}

/* Panel Header */
.fav-panel-header {
    background: rgba(30, 30, 40, 0.95);
    border-bottom: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
}

.fav-panel-header:active {
    cursor: grabbing;
}

.fav-panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(255, 152, 0, 0.3);
}

#close-favorites-panel {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#close-favorites-panel:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Tabs */
.fav-tabs {
    display: flex;
    background: rgba(30, 30, 40, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: grab;
    user-select: none;
}

.fav-tabs:active {
    cursor: grabbing;
}

.fav-tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
}

.fav-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.fav-tab-btn.active {
    color: #ff9800;
    border-bottom-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

/* Mobile adaptations for tabs */
@media (max-width: 768px) {
    .fav-tabs {
        position: relative;
    }
    
    /* Swipe indicator for mobile */
    .fav-tabs::before {
        content: '';
        position: absolute;
        top: 5px;
        left: 50%;
        transform: translateX(-50%);
        width: 35px;
        height: 3px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
    
    .fav-tab-btn {
        padding: 10px 12px;
        padding-top: 14px;
        font-size: 12px;
        min-height: 42px;
    }
}

/* Tab Content */
.fav-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: rgba(25, 25, 35, 0.95);
}

.fav-tab-panel {
    display: none;
    padding: 16px;
}

.fav-tab-panel.active {
    display: block;
}

/* Save Section */
.fav-save-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fav-save-btn {
    width: 100%;
    padding: 8px 14px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fav-save-btn:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.fav-save-btn:active {
    background: rgba(76, 175, 80, 0.35);
}

/* Favorites List */
.fav-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.fav-item-clickable {
    cursor: pointer;
    user-select: none;
}

.fav-item-clickable:hover {
    background: rgba(50, 50, 60, 0.9);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.3);
    transform: translateX(4px);
}

.fav-item-clickable:active {
    transform: translateX(2px) scale(0.98);
    background: rgba(60, 60, 70, 1);
}

.fav-item-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 6px;
}

.fav-item-content {
    flex: 1;
    min-width: 0;
}

.fav-item-name {
    font-weight: 600;
    font-size: 13px;
    color: #e0e0e0;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.fav-item-coords {
    font-size: 11px;
    color: rgba(255, 152, 0, 0.8);
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.fav-item-address {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

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

.fav-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fav-quick-assign-btn {
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.fav-quick-assign-btn:hover {
    background: rgba(255, 152, 0, 0.3);
    border-color: rgba(255, 152, 0, 0.5);
}

.fav-rename-btn {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #2196f3;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.fav-rename-btn:hover {
    background: rgba(33, 150, 243, 0.3);
    border-color: rgba(33, 150, 243, 0.5);
}

.fav-delete-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.fav-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    line-height: 1.5;
}

/* Favorites Button in Main UI */
/* Styles removed - now uses same circular button style as pending-devices-btn from style.css */

/* Mobile Responsive Adaptations */
@media (max-width: 768px) {
    .fav-tab-panel {
        padding: 10px;
    }
    
    .fav-save-section {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }
    
    .fav-save-btn {
        padding: 9px 12px;
        font-size: 12px;
        min-height: 38px;
    }
    
    .fav-item {
        padding: 8px;
        gap: 8px;
    }
    
    .fav-item-icon {
        font-size: 18px;
        width: 32px;
        height: 32px;
    }
    
    .fav-item-name {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .fav-item-coords {
        font-size: 10px;
    }
    
    .fav-item-address {
        font-size: 9px;
    }
    
    .fav-delete-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .empty-state {
        padding: 30px 16px;
        font-size: 12px;
    }
}

/* Small Mobile Adaptations */
@media (max-width: 480px) {
    .fav-tab-panel {
        padding: 8px;
    }
    
    .fav-list {
        gap: 8px;
    }
    
    .fav-save-section {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    
    .fav-save-btn {
        padding: 8px 10px;
        font-size: 11px;
        min-height: 36px;
    }
    
    .fav-item {
        padding: 7px;
        gap: 7px;
    }
    
    .fav-item-icon {
        font-size: 16px;
        width: 28px;
        height: 28px;
    }
    
    .fav-item-name {
        font-size: 11px;
        margin-bottom: 2px;
    }
    
    .fav-item-coords {
        font-size: 9px;
    }
    
    .fav-item-address {
        font-size: 8px;
    }
    
    .fav-delete-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .fav-tab-btn {
        padding: 8px 10px;
        padding-top: 12px;
        font-size: 11px;
        min-height: 38px;
    }
    
    .empty-state {
        padding: 25px 12px;
        font-size: 11px;
    }
}

/* Tablet Adaptations */
@media (min-width: 769px) and (max-width: 1024px) {
    .fav-tab-panel {
        padding: 18px;
    }
    
    .fav-tab-btn {
        font-size: 14px;
    }
    
    .fav-item {
        padding: 12px;
    }
}

/* Desktop Adaptations */
@media (min-width: 1400px) {
    .fav-tab-panel {
        padding: 20px;
    }
    
    .fav-list {
        gap: 12px;
    }
    
    .fav-item {
        padding: 12px;
    }
    
    .fav-item-name {
        font-size: 14px;
    }
    
    .fav-save-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Quick Assign Dropdown */
.quick-assign-dropdown {
    position: fixed;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 152, 0, 0.4);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 2000;
    min-width: 160px;
    max-width: 200px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.quick-assign-dropdown:not(.hidden) {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.quick-assign-header {
    font-size: 11px;
    color: rgba(255, 152, 0, 0.9);
    text-align: center;
    padding: 6px 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 152, 0, 0.2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-assign-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.quick-assign-item {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.quick-assign-btn {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    flex: 1;
}

.quick-assign-btn::before {
    content: 'Button ';
    font-size: 11px;
    opacity: 0.7;
}

.quick-assign-btn:hover {
    background: rgba(255, 152, 0, 0.3);
    border-color: rgba(255, 152, 0, 0.6);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.quick-assign-btn:active {
    transform: translateX(1px);
}

.quick-assign-btn.assigned {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
    color: #4caf50;
}

.quick-assign-btn.assigned::after {
    content: '✓';
    font-size: 14px;
    opacity: 0.8;
}

.quick-assign-btn.assigned:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Clear button for assigned items */
.quick-assign-clear-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.quick-assign-item.assigned .quick-assign-clear-btn {
    display: flex;
}

.quick-assign-clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.quick-assign-clear-btn:active {
    transform: scale(0.95);
}

/* Scrollbar for dropdown list */
.quick-assign-list::-webkit-scrollbar {
    width: 6px;
}

.quick-assign-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.quick-assign-list::-webkit-scrollbar-thumb {
    background: rgba(255, 152, 0, 0.4);
    border-radius: 3px;
}

.quick-assign-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 152, 0, 0.6);
}

/* Mobile adaptations */
@media (max-width: 768px) {
    .quick-assign-dropdown {
        min-width: 140px;
        max-width: 180px;
        padding: 6px;
    }
    
    .quick-assign-header {
        font-size: 10px;
        padding: 5px 6px;
        margin-bottom: 6px;
    }
    
    .quick-assign-list {
        max-height: 180px;
        gap: 3px;
    }
    
    .quick-assign-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 28px;
    }
}

/* Scrollbar Styling */
.fav-panel-content::-webkit-scrollbar {
    width: 10px;
}

.fav-panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.fav-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 152, 0, 0.5);
    border-radius: 5px;
}

.fav-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 152, 0, 0.7);
}

/* Rename Modal */
.rename-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.rename-modal:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.rename-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.rename-modal-content {
    position: relative;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(33, 150, 243, 0.4);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    min-width: 320px;
    max-width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

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

.rename-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(33, 150, 243, 0.3);
    background: rgba(33, 150, 243, 0.1);
}

.rename-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #2196f3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rename-modal-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.rename-modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.rename-modal-body {
    padding: 20px;
}

.rename-modal-label {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    font-weight: 500;
}

.rename-modal-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.rename-modal-input:focus {
    border-color: rgba(33, 150, 243, 0.6);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.rename-modal-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.rename-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
}

.rename-modal-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
}

.rename-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.rename-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.rename-modal-btn-save {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.4);
    color: #2196f3;
}

.rename-modal-btn-save:hover {
    background: rgba(33, 150, 243, 0.3);
    border-color: rgba(33, 150, 243, 0.6);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.rename-modal-btn-save:active {
    transform: scale(0.98);
}

/* Mobile adaptations */
@media (max-width: 768px) {
    .rename-modal-content {
        min-width: 280px;
        max-width: calc(100% - 40px);
    }
    
    .rename-modal-header {
        padding: 14px 16px;
    }
    
    .rename-modal-title {
        font-size: 15px;
    }
    
    .rename-modal-body {
        padding: 16px;
    }
    
    .rename-modal-footer {
        padding: 12px 16px;
    }
    
    .rename-modal-btn {
        padding: 9px 14px;
        font-size: 13px;
    }
}

/* Notification */
.fav-notification {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
