/* 
 * Cart Export Styles
 */

.hitech-cart-export {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hitech-export-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: -0.375rem; /* Компенсируем margin у детей */
}

.hitech-export-buttons > * {
    margin: 0.375rem;
}

.hitech-export-btn,
.hitech-share-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #333333;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 44px; /* Accessibility */
}

.hitech-export-btn:hover,
.hitech-export-btn:focus,
.hitech-share-btn:hover,
.hitech-share-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    outline: none;
}

.hitech-export-btn:active,
.hitech-share-btn:active {
    transform: translateY(0);
}

/* Specific button styles */
.hitech-export-csv {
    border-color: #28a745;
    color: #28a745;
}

.hitech-export-csv:hover,
.hitech-export-csv:focus {
    background: #28a745;
    color: white;
}

.hitech-export-xlsx {
    border-color: #007bff;
    color: #007bff;
}

.hitech-export-xlsx:hover,
.hitech-export-xlsx:focus {
    background: #007bff;
    color: white;
}

.hitech-export-pdf {
    border-color: #dc3545;
    color: #dc3545;
}

.hitech-export-pdf:hover,
.hitech-export-pdf:focus {
    background: #dc3545;
    color: white;
}

/* Share button - отличается только цветом */
.hitech-share-btn {
    border-color: #6c757d;
    color: #6c757d;
    position: relative; /* Для позиционирования стрелочки */
}

.hitech-share-btn:hover,
.hitech-share-btn:focus {
    background: #6c757d;
    color: white;
}

/* Стрелочка у кнопки Share */
.hitech-share-btn::after {
    content: '';
    display: inline-block;
    margin-left: 8px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.2s;
}

.hitech-share-btn[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Icons */
.hitech-export-btn i,
.hitech-share-btn i {
    font-size: 1.1em;
    min-width: 1.2em;
    text-align: center;
    margin-right: 0.5rem; /* Заменяем gap */
}

.hitech-export-btn:not(:has(.hitech-export-label)) i,
.hitech-share-btn:not(:has(.hitech-export-label)) i {
    margin-right: 0;
}

.hitech-export-label {
    white-space: nowrap;
}

/* Status messages */
.hitech-export-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    display: none;
}

.hitech-export-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.hitech-export-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hitech-export-status.loading {
    display: block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.hitech-export-status.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Loading state for buttons */
.hitech-export-btn.loading,
.hitech-share-btn.loading {
    opacity: 0.7;
    cursor: wait;
    position: relative;
}

.hitech-export-btn.loading::after,
.hitech-share-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== SHARE POP-UP MENU ========== */
.hitech-share-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.hitech-share-menu.show {
    display: block;
}

.hitech-share-menu__inner {
    padding: 8px 0;
}

.hitech-share-option {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #333;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.hitech-share-option:hover,
.hitech-share-option:focus {
    background: #f8f9fa;
    outline: none;
}

.hitech-share-option i {
    width: 20px;
    text-align: center;
    margin-right: 10px; /* Заменяем gap */
    font-size: 1.1em;
}

/* Цвета иконок в меню */
.hitech-share-whatsapp i {
    color: #25D366; /* WhatsApp green */
}

.hitech-share-email i {
    color: #EA4335; /* Google/Gmail red */
}

.hitech-share-option span {
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .hitech-export-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hitech-export-buttons > * {
        width: 100%;
        margin: 0.375rem 0;
    }
    
    .hitech-export-btn,
    .hitech-share-btn {
        justify-content: center;
    }
    
    .hitech-share-menu {
        position: static;
        margin-top: 10px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hitech-export-btn,
    .hitech-share-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .hitech-export-btn i,
    .hitech-share-btn i {
        font-size: 1em;
    }
    
    .hitech-share-menu {
        min-width: auto;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .hitech-export-btn,
    .hitech-share-btn {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .hitech-export-btn:hover,
    .hitech-export-btn:focus,
    .hitech-share-btn:hover,
    .hitech-share-btn:focus {
        background: #4a5568;
    }
    
    .hitech-share-menu {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .hitech-share-option {
        color: #e2e8f0;
    }
    
    .hitech-share-option:hover,
    .hitech-share-option:focus {
        background: #4a5568;
    }
    
    .hitech-export-status.success {
        background: #22543d;
        color: #9ae6b4;
        border-color: #276749;
    }
    
    .hitech-export-status.error {
        background: #742a2a;
        color: #feb2b2;
        border-color: #9b2c2c;
    }
    
    .hitech-export-status.loading {
        background: #744210;
        color: #faf089;
        border-color: #d69e2e;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .hitech-export-btn,
    .hitech-share-btn {
        border-width: 3px;
    }
    
    .hitech-export-status,
    .hitech-share-menu {
        border-width: 2px;
    }
    
    .hitech-share-menu {
        box-shadow: 0 0 0 3px black;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hitech-export-btn,
    .hitech-share-btn {
        transition: none;
    }
    
    .hitech-export-btn:hover,
    .hitech-export-btn:focus,
    .hitech-share-btn:hover,
    .hitech-share-btn:focus {
        transform: none;
    }
    
    .hitech-share-btn::after {
        transition: none;
    }
    
    .hitech-export-btn.loading::after,
    .hitech-share-btn.loading::after,
    .hitech-export-status.loading::after {
        animation: none;
    }
}

/* Print styles */
@media print {
    .hitech-cart-export {
        display: none;
    }
}