/**
 * EED Device Search Frontend Styles
 * Responsive CSS for all frontend components
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.eed-device-search,
.eed-device-finder,
.eed-compatibility-checker,
.eed-complete-interface {
    max-width: 100%;
    margin: 0 auto 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
}

.eed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.eed-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: eed-spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* ==========================================================================
   Buttons and Form Elements
   ========================================================================== */

.eed-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 1px solid #0073aa;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 120px;
}

.eed-btn:hover {
    background: #005177;
    border-color: #005177;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,115,170,0.3);
}

.eed-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,115,170,0.3);
}

.eed-btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.eed-btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.eed-btn-outline {
    background: transparent;
    color: #0073aa;
}

.eed-btn-outline:hover {
    background: #0073aa;
    color: #fff;
}

.eed-btn-success {
    background: #28a745;
    border-color: #28a745;
}

.eed-btn-success:hover {
    background: #218838;
    border-color: #218838;
}

.eed-btn-danger {
    background: #dc3545;
    border-color: #dc3545;
}

.eed-btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.eed-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.eed-input,
.eed-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.eed-input:focus,
.eed-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

/* ==========================================================================
   Device Search Component
   ========================================================================== */

.eed-device-search {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.eed-search-form .search-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.eed-search-input {
    flex: 1;
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.eed-search-btn {
    padding: 1rem 2rem;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.eed-search-btn:hover {
    background: #005177;
    transform: translateY(-2px);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.search-suggestions .suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.search-suggestions .suggestion-item:hover,
.search-suggestions .suggestion-item.active {
    background: #f8f9fa;
}

.search-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.eed-search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.eed-results-container {
    margin-top: 1.5rem;
}

.device-result {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.device-result:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,115,170,0.1);
    transform: translateY(-1px);
}

.device-result .device-image {
    width: 60px;
    height: 60px;
    margin-right: 1rem;
    border-radius: 4px;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.device-result .device-info {
    flex: 1;
}

.device-result .device-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #0073aa;
}

.device-result .device-manufacturer {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.device-result .device-type {
    color: #999;
    font-size: 0.8rem;
}

/* ==========================================================================
   Device Finder Component
   ========================================================================== */

.eed-device-finder {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.finder-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    width: 20%;
    transition: width 0.5s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-steps .step {
    padding: 0.5rem 1rem;
    background: #e5e5e5;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.progress-steps .step.active {
    background: #0073aa;
    color: white;
}

.progress-steps .step.completed {
    background: #28a745;
    color: white;
}

.finder-step {
    min-height: 300px;
}

.finder-step h3 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.letter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.letter-button {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.letter-button:hover {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: scale(1.05);
}

.manufacturer-list,
.type-list,
.range-list,
.device-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 0.5rem;
}

.list-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.list-item:hover {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
}

.list-item.selected {
    background: #e8f4ff;
    border-left: 4px solid #0073aa;
}

.finder-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

/* ==========================================================================
   Compatibility Checker Component
   ========================================================================== */

.eed-compatibility-checker {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.compatibility-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-row {
    margin-bottom: 1.5rem;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.device-suggestions,
.product-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.compatibility-results {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 6px;
    background: #f8f9fa;
}

.compatibility-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.compatibility-status.compatible {
    color: #28a745;
}

.compatibility-status.incompatible {
    color: #dc3545;
}

.compatibility-status .status-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.selected-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.selected-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.selected-item .item-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
    background: #f0f0f0;
}

.selected-item .item-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.selected-item .item-details {
    font-size: 0.9rem;
    color: #666;
}

/* ==========================================================================
   Complete Interface (Tabbed)
   ========================================================================== */

.eed-complete-interface {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tab-navigation {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e5;
}

.tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-button:hover {
    background: rgba(0,115,170,0.1);
    color: #0073aa;
}

.tab-button.active {
    background: white;
    color: #0073aa;
    border-bottom: 3px solid #0073aa;
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-content {
    padding: 2rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ==========================================================================
   Product Grid and Cards
   ========================================================================== */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0,115,170,0.15);
    transform: translateY(-2px);
}

.product-card .product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 3rem;
}

.product-card .product-info {
    padding: 1rem;
}

.product-card .product-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0073aa;
    margin-bottom: 0.5rem;
}

.product-card .product-price .sale-price {
    color: #e74c3c;
    margin-right: 0.5rem;
}

.product-card .product-price .regular-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
}

.product-card .product-stock {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.product-card .stock-in-stock {
    color: #28a745;
}

.product-card .stock-out-of-stock {
    color: #dc3545;
}

.product-card .stock-on-backorder {
    color: #ffc107;
}

.product-card .product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.product-card .quantity-selector {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.product-card .add-to-cart-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.product-card .add-to-cart-btn:hover {
    background: #218838;
}

.product-card .add-to-cart-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.product-card .compatibility-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.eed-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

.pagination-button {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #333;
}

.pagination-button:hover {
    background: #f8f9fa;
    border-color: #0073aa;
}

.pagination-button.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.pagination-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pagination-info {
    margin: 0 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .eed-device-search,
    .eed-device-finder,
    .eed-compatibility-checker,
    .eed-complete-interface {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .eed-search-form .search-input-container {
        flex-direction: column;
    }

    .eed-search-filters {
        grid-template-columns: 1fr;
    }

    .tab-navigation {
        flex-direction: column;
    }

    .tab-button {
        border-bottom: none;
        border-right: 3px solid transparent;
    }

    .tab-button.active {
        border-bottom: none;
        border-right: 3px solid #0073aa;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .device-result {
        flex-direction: column;
        text-align: center;
    }

    .device-result .device-image {
        margin: 0 0 1rem 0;
    }

    .letter-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .finder-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .eed-pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .selected-items {
        grid-template-columns: 1fr;
    }

    .letter-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    }

    .letter-button {
        font-size: 1rem;
    }

    .product-card .product-actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   Animations and Transitions
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.hidden { display: none; }
.visible { display: block; }

.success { color: #28a745; }
.error { color: #dc3545; }
.warning { color: #ffc107; }
.info { color: #17a2b8; }

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .eed-device-search,
    .eed-device-finder,
    .eed-compatibility-checker,
    .eed-complete-interface {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .eed-btn,
    .tab-button,
    .pagination-button,
    .add-to-cart-btn {
        display: none;
    }

    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}