/* 
 * AZ Automation Contact System - Final Optimization
 * Complete contact integration with advanced features
 * Version: Enterprise 2.0
 */

/* ===== FLOATING CONTACT SYSTEM ENHANCEMENTS ===== */
.floating-contact-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.floating-contact-wrapper:hover {
    transform: translateY(-2px);
}

.floating-contact-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0066cc 0%, #004499 50%, #00b4db 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.floating-contact-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.floating-contact-toggle:hover::before {
    left: 100%;
}

.floating-contact-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 35px rgba(0, 102, 204, 0.4);
}

.floating-contact-toggle:active {
    transform: scale(0.95);
}

/* Floating Menu Animation */
.floating-contact-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 102, 204, 0.1);
    transform: scale(0) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 200px;
}

.floating-contact-menu.open {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.floating-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    position: relative;
    overflow: hidden;
}

.floating-contact-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 102, 204, 0.1), transparent);
    transition: left 0.3s;
}

.floating-contact-item:hover::before {
    left: 100%;
}

.floating-contact-item:hover {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
}

.floating-contact-item i,
.floating-contact-item .icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.floating-contact-item .contact-info {
    flex: 1;
}

.floating-contact-item .contact-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 2px;
}

.floating-contact-item .contact-detail {
    font-size: 12px;
    color: #666;
    opacity: 0.8;
}

/* ===== CONTACT BUTTONS GRID OPTIMIZATION ===== */
.contact-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 24px;
    border: 2px solid transparent;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    min-height: 60px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.contact-btn:hover::before {
    left: 100%;
}

.contact-btn i,
.contact-btn .icon {
    margin-right: 12px;
    font-size: 20px;
    transition: transform 0.3s ease;
}

.contact-btn:hover i,
.contact-btn:hover .icon {
    transform: scale(1.2) rotate(5deg);
}

/* Specific button styles */
.contact-btn.phone {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.contact-btn.phone:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.contact-btn.zalo {
    background: linear-gradient(135deg, #0180ff, #0066cc);
    color: white;
    box-shadow: 0 8px 25px rgba(1, 128, 255, 0.3);
}

.contact-btn.zalo:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(1, 128, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.contact-btn.whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

.contact-btn.whatsapp:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.contact-btn.linkedin {
    background: linear-gradient(135deg, #0077b5, #005885);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 119, 181, 0.3);
}

.contact-btn.linkedin:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 119, 181, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ===== ENHANCED FOOTER CONTACT ===== */
.footer-contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.footer-contact-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.footer-contact-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.footer-contact-item i,
.footer-contact-item .icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.footer-contact-item .contact-text {
    flex: 1;
}

.footer-contact-item .contact-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 2px;
}

.footer-contact-item .contact-value {
    font-size: 14px;
    font-weight: 500;
}

/* ===== RESPONSIVE DESIGN OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    .contact-buttons-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 20px 0;
    }
    
    .contact-btn {
        padding: 16px 20px;
        font-size: 15px;
        min-height: 55px;
    }
    
    .footer-contact-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .floating-contact-wrapper {
        bottom: 20px;
        right: 20px;
    }
    
    .floating-contact-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    .floating-contact-menu {
        bottom: 65px;
        min-width: 180px;
    }
    
    .floating-contact-item {
        padding: 10px 14px;
    }
    
    .floating-contact-item .contact-label {
        font-size: 13px;
    }
    
    .floating-contact-item .contact-detail {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .contact-btn {
        padding: 14px 18px;
        font-size: 14px;
        min-height: 50px;
    }
    
    .contact-btn i,
    .contact-btn .icon {
        font-size: 18px;
        margin-right: 10px;
    }
    
    .floating-contact-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .floating-contact-menu {
        bottom: 60px;
        min-width: 160px;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
.contact-btn:focus,
.floating-contact-toggle:focus,
.floating-contact-item:focus {
    outline: 3px solid rgba(0, 102, 204, 0.5);
    outline-offset: 2px;
}

.contact-btn:focus-visible,
.floating-contact-toggle:focus-visible,
.floating-contact-item:focus-visible {
    outline: 3px solid rgba(0, 102, 204, 0.8);
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .contact-btn,
    .floating-contact-toggle,
    .floating-contact-item,
    .floating-contact-menu {
        transition: none;
        animation: none;
    }
    
    .contact-btn::before,
    .floating-contact-toggle::before,
    .floating-contact-item::before {
        display: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .contact-btn {
        border: 3px solid currentColor;
    }
    
    .floating-contact-menu {
        border: 2px solid #000;
        background: #fff;
    }
    
    .floating-contact-item {
        border: 1px solid #000;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .floating-contact-wrapper,
    .floating-contact-menu {
        display: none !important;
    }
    
    .contact-btn {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    
    .footer-contact-item {
        background: transparent !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.contact-btn,
.floating-contact-toggle,
.floating-contact-item {
    will-change: transform, box-shadow;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize animations for better performance */
.floating-contact-menu {
    contain: layout style paint;
}

.contact-buttons-grid {
    contain: layout;
}

/* ===== LOADING STATES ===== */
.contact-btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.contact-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== SUCCESS STATES ===== */
.contact-btn.success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    transform: scale(1.05);
}

.contact-btn.success::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    50% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===== ADVANCED HOVER EFFECTS ===== */
.contact-btn {
    background-size: 200% 200%;
    background-position: 0% 50%;
}

.contact-btn:hover {
    background-position: 100% 50%;
    animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== TOOLTIP ENHANCEMENTS ===== */
.contact-btn[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    animation: tooltipFadeIn 0.3s ease;
}

.contact-btn[data-tooltip]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    margin-bottom: 2px;
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from { 
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to { 
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== FINAL TOUCH: MICRO-INTERACTIONS ===== */
.contact-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.floating-contact-item:active {
    transform: translateX(3px) scale(0.98);
}

/* Pulse effect for urgent contacts */
.contact-btn.urgent {
    animation: urgentPulse 2s infinite;
}

@keyframes urgentPulse {
    0% { 
        box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
    }
    50% { 
        box-shadow: 0 8px 25px rgba(220, 53, 69, 0.6);
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
    }
}