/* Floating Widget Styles */
.floating-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Poppins', sans-serif;
}

/* Floating Button */
.floating-btn {
    position: relative;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #0b5fa5, #02a7d9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 35px rgba(11, 95, 165, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: float 3s ease-in-out infinite;
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(11, 95, 165, 0.6);
}

.floating-btn:active {
    transform: scale(0.95);
}

.floating-icon {
    color: white;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.floating-btn:hover .floating-icon {
    transform: scale(1.1);
}

/* Pulse Ring Animation */
.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid #0b5fa5;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0;
}

/* Tooltip */
.floating-tooltip {
    position: absolute;
    right: 85px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.floating-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -5px;
    transform: translateY(-50%);
    border-left: 5px solid #333;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.floating-btn:hover .floating-tooltip {
    opacity: 1;
    visibility: visible;
    right: 75px;
}

/* Widget Panel */
.widget-panel {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px); /* Prevent overflow on mobile */
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.widget-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    z-index: 10000; /* Ensure it's above everything */
}

/* Panel Header */
.panel-header {
    background: linear-gradient(135deg, #0b5fa5, #02a7d9);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.panel-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #02a7d9;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-panel {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-panel:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Panel Content */
.panel-content {
    padding: 0;
    max-height: 60vh; /* Use viewport height instead of fixed height */
    overflow-y: auto;
}

/* Quick Actions */
.quick-actions {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.action-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.action-item:hover {
    background: #f8faff;
    border-color: #0b5fa5;
    transform: translateX(5px);
}

.action-item:last-child {
    margin-bottom: 0;
}

.action-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0b5fa5, #02a7d9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

.action-text {
    flex: 1;
}

.action-text strong {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.action-text span {
    font-size: 12px;
    color: #666;
}

/* Contact Form */
.contact-form {
  padding: 20px;
}

.contact-form h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #333;
  font-weight: 600;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: #0b5fa5;
  box-shadow: 0 0 0 3px rgba(11, 95, 165, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #0b5fa5, #02a7d9);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(11, 95, 165, 0.4);
}

/* Panel Footer */
.panel-footer {
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.availability {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: statusPulse 2s infinite;
}

.response-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e91e63;
    color: white;
    font-size: 10px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.4);
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .floating-widget {
        bottom: 20px;
        right: 20px;
    }

    .floating-btn {
        width: 60px;
        height: 60px;
    }

    .floating-icon {
        font-size: 20px;
    }

    .widget-panel {
        width: 320px;
        max-width: calc(100vw - 40px);
        right: 0;
        bottom: 80px;
    }

    .floating-tooltip {
        display: none;
    }

    .panel-content {
        max-height: 55vh;
    }
}

@media (max-width: 480px) {
    .floating-widget {
        bottom: 15px;
        right: 15px;
    }

    .floating-btn {
        width: 55px;
        height: 55px;
    }

    .floating-icon {
        font-size: 18px;
    }

    .widget-panel {
        width: 280px;
        max-width: calc(100vw - 30px);
        right: 0;
        bottom: 75px;
    }

    .panel-content {
        max-height: 50vh;
    }

    .panel-header {
        padding: 15px;
    }

    .panel-header h3 {
        font-size: 16px;
    }

    .quick-actions,
    .contact-form {
        padding: 15px;
    }

    .action-item {
        padding: 10px;
    }

    .action-icon {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    .action-text strong {
        font-size: 13px;
    }

    .action-text span {
        font-size: 11px;
    }

    .contact-form h4 {
        font-size: 15px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px;
        font-size: 13px;
    }

    .submit-btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .panel-footer {
        padding: 12px 15px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* Extra small devices (phones, 360px and down) */
@media (max-width: 360px) {
    .floating-widget {
        bottom: 10px;
        right: 10px;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
    }

    .floating-icon {
        font-size: 16px;
    }

    .widget-panel {
        width: 260px;
        max-width: calc(100vw - 20px);
        bottom: 65px;
    }

    .panel-content {
        max-height: 45vh;
    }

    .quick-actions,
    .contact-form {
        padding: 12px;
    }

    .action-item {
        padding: 8px;
    }

    .action-icon {
        width: 32px;
        height: 32px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .widget-panel {
        max-height: 80vh;
        bottom: 70px;
    }

    .panel-content {
        max-height: 45vh;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
    }

    .floating-icon {
        font-size: 18px;
    }
}

/* Large screens adjustment */
@media (min-width: 1440px) {
    .floating-widget {
        bottom: 40px;
        right: 40px;
    }

    .widget-panel {
        width: 400px;
    }
}

/* Scrollbar Styling */
.panel-content::-webkit-scrollbar {
    width: 4px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #0b5fa5;
    border-radius: 2px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #02a7d9;
}

/* Prevent body scroll when panel is open on mobile */
body.widget-panel-open {
    overflow: hidden;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .floating-widget {
        bottom: max(30px, env(safe-area-inset-bottom));
        right: max(30px, env(safe-area-inset-right));
    }
    
    @media (max-width: 768px) {
        .floating-widget {
            bottom: max(20px, env(safe-area-inset-bottom));
            right: max(20px, env(safe-area-inset-right));
        }
    }
    
    @media (max-width: 480px) {
        .floating-widget {
            bottom: max(15px, env(safe-area-inset-bottom));
            right: max(15px, env(safe-area-inset-right));
        }
    }
}