/* Site indicator in top right */
.site-indicator {
    position: fixed;
    top: 20px;
    right: 70px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: fit-content;
    max-width: calc(100vw - 60px);
}

.current-sites-display {
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 150px;
}

.selected-site-line {
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    text-indent: -8px;
    padding-left: 8px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: break-word;
}

.selected-site-line:not(:first-child) {
    margin-top: 2px;
}

.no-sites-selected {
    color: #666;
    font-style: italic;
}

.change-site-link {
    color: #007bff;
    text-decoration: none;
    font-size: 12px;
    border: 1px solid #007bff;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s;
    white-space: nowrap;
}

.change-site-link:hover {
    background-color: #007bff;
    color: white;
    text-decoration: none;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 600px;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    position: relative;
    padding: 20px 30px 15px 30px;  /* Reduced padding */
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 50px;  /* Reduced min-height */
}

.modal-header span {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
    width: 100%;
}

.info-icon {
    display: inline;
    margin-left: 4px;
    color: #4a8bc2 !important;
    font-size: 12px !important;
    cursor: help;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    position: relative;
}

.info-icon:hover {
    opacity: 1;
    color: #7bb3e0 !important;
}

.modal-body {
    padding: 25px 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-body p {
    margin-bottom: 15px;
    color: #666;
    flex-shrink: 0;
}

/* Selected Sites Container */
.selected-sites-container {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.selected-sites-container h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.selected-sites-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f8f9fa;
}

.no-sites-message {
    color: #666;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.site-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: white;
    color: #007bff;
    border: 1px solid #007bff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.site-bubble:hover {
    cursor: pointer;
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.site-bubble-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-bubble-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.site-bubble:hover .site-bubble-remove {
    opacity: 1;
    visibility: visible;
    color: #dc3545;
}

/* Modal Actions */
.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

#cancel-btn {
    position: absolute;
    top: 8px;  /* Position closer to top */
    right: 15px;
    background-color: #f5f5f5;  /* Grey background */
    border: 1px solid #ddd;     /* Light border */
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    padding: 6px 10px;  /* Reduced padding */
    border-radius: 4px;
    transition: all 0.2s;
}

#cancel-btn:hover {
    background-color: #e9ecef;  /* Darker grey on hover */
    border-color: #ccc;
    color: #333;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-primary:disabled {
    background-color: #6c757d;
    color: #fff;
    border-color: #6c757d;
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary:disabled:hover {
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Autocomplete styles */
.autocomplete-container {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.autocomplete-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background-color: white;
    box-sizing: border-box;
    transition: border-color 0.2s;
    flex-shrink: 0;
}

.autocomplete-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.autocomplete-dropdown {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow-y: auto;
    z-index: 1001;
    display: block;
    max-height: 300px;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-dropdown.hide {
    display: none;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f8f9fa;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item-name {
    font-weight: 500;
    color: #333;
    text-align: left;
    flex: 1;
}

.autocomplete-item-category {
    font-size: 12px;
    color: #666;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.no-results {
    padding: 12px 16px;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .site-indicator {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px;
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
        max-width: calc(100vw - 20px);
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .current-sites-display {
        flex: 1;
        flex-shrink: 1;
        min-width: 0;
        max-width: none;
        text-align: left;
        overflow: hidden;
    }
    
    .selected-site-line {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .change-site-link {
        flex-shrink: 0;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .modal-content {
        width: calc(100vw - 40px);
        height: 70vh;
        margin: 20px;
    }
    
    .modal-header {
        padding: 25px 20px 15px 20px;  /* Reduced padding on mobile */
        min-height: 55px;  /* Reduced min-height on mobile */
    }
    
    .modal-header span {
        font-size: 16px;
    }
    
    #cancel-btn {
        top: 6px;  /* Keep it close to the top */
        right: 12px;
        font-size: 14px;
        padding: 5px 8px;  /* Smaller padding on mobile */
    }
    
    .autocomplete-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .selected-sites-bubbles {
        max-height: 120px;
        overflow-y: auto;
    }
    
    .site-bubble-name {
        max-width: 150px;
    }
}
