/* CSS Variables */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #45a049;
    --text-color: #333;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    max-width: 90%;
    width: 400px;
    overflow: hidden;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-right: 4px solid var(--primary-color);
}

.notification.success .notification-content {
    border-right-color: var(--success-color);
}

.notification.error .notification-content {
    border-right-color: var(--danger-color);
}

.notification.warning .notification-content {
    border-right-color: var(--warning-color);
}

.notification.info .notification-content {
    border-right-color: var(--info-color);
}

.notification .close-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    margin-right: 10px;
    padding: 0;
    line-height: 1;
}

.notification .close-btn:hover {
    color: #666;
}

/* Search Interface Styles */
.search-interface {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

/* Search Main Input */
.search-main {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-input-container {
    position: relative;
    flex: 1;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    transition: all 0.3s ease;
    display: block;
}

.search-input-container:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1) !important;
}

.search-input-container:invalid {
    border-color: #e0e0e0 !important;
    box-shadow: none !important;
}

.search-input-container::before,
.search-input-container::after {
    display: none;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: 'Cairo', sans-serif;
    outline: none;
    color: #333;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: #999;
}

.search-input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.search-input:focus-visible {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.search-input:invalid {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.search-input::before,
.search-input::after {
    display: none;
}

/* إزالة جميع تنسيقات المتصفح الافتراضية */
.search-input,
.search-input:focus,
.search-input:active,
.search-input:hover,
.search-input:valid,
.search-input:invalid {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.search-submit-btn {
    background: var(--primary-color);
    border: none;
    padding: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.search-submit-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.search-submit-btn i {
    font-size: 18px;
    transition: all 0.3s ease;
}

/* تحسينات لتحويل الزر */
.search-submit-btn.clear-mode {
    background: #dc3545;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.search-submit-btn.clear-mode:hover {
    background: #c82333;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.search-submit-btn.clear-mode i {
    transform: rotate(90deg);
}

/* Search Options */
.search-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-option-group {
    flex: 1;
    min-width: 250px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: visible;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.search-option-group:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-option-group.active {
    z-index: 20;
}

.option-toggle {
    width: 100%;
    background: #fff;
    border: none;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

.option-toggle:hover {
    background: #f0f0f0;
}

.option-toggle.active {
    background: var(--primary-color);
    color: white;
}

.option-toggle span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.option-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.option-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.option-content.active {
    max-height: 300px;
    overflow-y: auto;
}

.checkbox-group {
    padding: 15px 20px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.checkbox-item:hover {
    color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Search Results */
.search-results-header {
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 2px solid #e0e0e0;
}

.search-results-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.no-results h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
}

.no-results p {
    margin: 8px 0;
    font-size: 16px;
    line-height: 1.5;
}

/* Search Welcome */
.search-welcome {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.search-welcome-icon {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 25px;
    opacity: 0.7;
}

.search-welcome h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.search-welcome p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Search Button in Navigation */
.search-btn {
    background: var(--primary-color) !important;
    color: white !important;
    border-radius: 25px !important;
    padding: 8px 16px !important;
    margin-left: 10px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.search-btn:hover {
    background: var(--secondary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
}

.search-btn.active {
    background: #2e7d32 !important;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4) !important;
}

.search-btn i {
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-interface {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .search-options {
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .search-option-group {
        min-width: 150px;
        flex: 1;
    }
    
    .search-main {
        gap: 10px;
    }
    
    .search-input {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .search-submit-btn {
        width: 45px;
        height: 45px;
        padding: 12px;
    }
    
    .option-toggle {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .checkbox-group {
        padding: 12px 15px;
    }
    
    .checkbox-item {
        font-size: 13px;
        padding: 6px 0;
    }
    
    .search-welcome {
        padding: 50px 15px;
    }
    
    .search-welcome-icon {
        font-size: 60px;
    }
    
    .search-welcome h3 {
        font-size: 22px;
    }
    
    .search-welcome p {
        font-size: 14px;
    }
    
    .no-results {
        padding: 40px 15px;
    }
    
    .no-results-icon {
        font-size: 48px;
    }
    
    .no-results h3 {
        font-size: 20px;
    }
    
    .no-results p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .search-interface {
        padding: 15px 10px;
    }
    
    .search-input-container {
        border-radius: 25px;
    }
    
    .search-input {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .search-submit-btn {
        padding: 10px 12px;
        min-width: 45px;
    }
    
    .search-submit-btn i {
        font-size: 16px;
    }
    
    .option-toggle {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .checkbox-group {
        padding: 10px 12px;
    }
    
    .checkbox-item {
        font-size: 12px;
        padding: 5px 0;
    }
    
    .checkmark {
        width: 18px;
        height: 18px;
    }
    
    .search-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
        margin-left: 5px !important;
    }
    
    .search-btn i {
        font-size: 12px;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-interface {
    animation: fadeIn 0.5s ease;
}

.search-results-header {
    animation: fadeIn 0.3s ease;
}

/* Custom scrollbar for option content */
.option-content::-webkit-scrollbar {
    width: 6px;
}

.option-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.option-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.option-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus styles for accessibility */
.search-input:focus,
.option-toggle:focus,
.checkbox-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .search-interface {
        border: 2px solid #000;
    }
    
    .search-option-group {
        border: 2px solid #000;
    }
    
    .option-toggle {
        border-bottom: 1px solid #000;
    }
}

/* Product card styles to match main page */
.product-name {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    font-weight: bold;
    color: #333;
}

.product-price {
    font-size: 0.95rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-weight: bold;
}

/* Product text styles to match main page */
.product-text-name {
    font-size: 0.85rem;
    font-weight: bold;
    color: #333;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.product-text-price {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: bold;
    flex-shrink: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .product-text-name {
        font-size: 0.8rem;
    }
    
    .product-text-price {
        font-size: 0.85rem;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .product-price {
        font-size: 0.85rem;
    }
}

/* Cart icon specific styles for search page */
@media (max-width: 768px) {
    .category-header-sticky .cart-icon {
        left: -70px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .category-header-sticky .category-title {
        margin-left: 120px;
        width: calc(100% - 120px);
    }
}

/* Notification responsive styles for search page */
@media (max-width: 768px) {
    .notification {
        max-width: 95%;
        width: 350px;
        top: 15px;
    }
    
    .notification-content {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .notification .close-btn {
        font-size: 18px;
        margin-right: 8px;
    }
}

@media (max-width: 480px) {
    .notification {
        max-width: 98%;
        width: 320px;
        top: 10px;
    }
    
    .notification-content {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .notification .close-btn {
        font-size: 16px;
        margin-right: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .search-interface,
    .search-results-header,
    .option-toggle,
    .toggle-icon,
    .option-content,
    .search-submit-btn,
    .search-btn {
        transition: none;
        animation: none;
    }
}