/* Moto Battery Selector Styles */
.moto-selector-container {
    max-width: 100%;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    font-family: Arial, sans-serif;
}

.moto-selector-container h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
}

.moto-selector-form {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row label {
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.form-row select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    min-height: 40px;
}

.form-row select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.search-button {
    padding: 12px 24px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover:not(:disabled) {
    background-color: #005a87;
}

.search-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.battery-results {
    margin-top: 20px;
    padding: 20px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.battery-results h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.battery-result {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
}

.battery-result h5 {
    color: #0073aa;
    margin-bottom: 10px;
    font-size: 16px;
}

.battery-option {
    margin-bottom: 8px;
    padding: 8px;
    background-color: white;
    border-left: 4px solid #0073aa;
    font-size: 14px;
}

.battery-option strong {
    color: #333;
}

.battery-notes {
    margin-top: 10px;
    padding: 8px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
}

.loading:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .moto-selector-container {
        margin: 10px;
        padding: 15px;
    }
    
    .moto-selector-container h3 {
        font-size: 20px;
    }
    
    .form-row select,
    .search-button {
        font-size: 14px;
    }
    
    .battery-result {
        padding: 10px;
    }
    
    .battery-result h5 {
        font-size: 14px;
    }
    
    .battery-option {
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .moto-selector-container {
        border: none;
        background-color: white;
        box-shadow: none;
    }
    
    .moto-selector-form {
        display: none;
    }
    
    .loading {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .moto-selector-container {
        border: 2px solid #000;
        background-color: white;
    }
    
    .search-button {
        background-color: #000;
        border: 2px solid #000;
    }
    
    .search-button:hover:not(:disabled) {
        background-color: #333;
    }
    
    .battery-option {
        border-left-color: #000;
    }
}

/* Focus Styles for Accessibility */
.form-row select:focus,
.search-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Error States */
.form-error {
    border-color: #dc3232 !important;
    background-color: #ffeaea !important;
}

.error-message {
    color: #dc3232;
    font-size: 13px;
    margin-top: 5px;
    padding: 8px 12px;
    background-color: #ffeaea;
    border: 1px solid #dc3232;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
}

/* Auto-select message styles */
.auto-select-message {
    color: #2e7d32;
    font-size: 13px;
    margin-top: 5px;
    padding: 8px 12px;
    background-color: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
    position: relative;
}

.auto-select-message::before {
    content: "ℹ️ ";
    margin-right: 5px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success States */
.form-success {
    border-color: #46b450 !important;
    background-color: #eafaea !important;
}

/* Battery Type Specific Styling */
.battery-option.gyz-series {
    border-left-color: #d63638;
}

.battery-option.high-performance {
    border-left-color: #f56e28;
}

.battery-option.agm {
    border-left-color: #0073aa;
}

.battery-option.conventional {
    border-left-color: #135e96;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Animation for results appearing */
.battery-results {
    animation: fadeIn 0.5s ease-in;
}

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

/* Product search results */
.battery-search-section,
.motx-search-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.battery-search-section h6,
.motx-search-section h6 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.motx-search-section h6 {
    color: #2e7d32;
}

/* MotX Integration Styles */
.motx-results {
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #2e7d32;
    border-radius: 4px;
}

.motx-battery-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.motx-battery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    text-decoration: none;
    color: inherit;
}

.motx-battery-item:last-child {
    margin-bottom: 0;
}

.motx-battery-info {
    flex: 1;
    padding-right: 15px;
}

.motx-battery-info h6 {
    margin: 0 0 10px 0;
    color: #2e7d32;
    font-size: 16px;
    font-weight: 600;
}

.motx-battery-info div {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

.motx-battery-info strong {
    color: #333;
}

.motx-article {
    color: #2e7d32 !important;
    font-weight: 500;
}

.motx-polarity {
    color: #1976d2 !important;
}

.motx-dimensions,
.motx-voltage,
.motx-capacity {
    color: #666;
}

.motx-compatible {
    color: #388e3c;
    font-size: 13px;
}

.motx-cross-refs {
    color: #757575;
    font-size: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.motx-battery-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    margin-right: 15px;
    flex-shrink: 0;
}

.motx-image-placeholder {
    width: 80px;
    height: 80px;
    margin-right: 15px;
    flex-shrink: 0;
}

.no-motx-products,
.motx-search-error {
    padding: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f5f5f5;
    border-radius: 4px;
}

.loading-search {
    padding: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.loading-search {
    padding: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 13px;
}

.search-error {
    padding: 10px;
    color: #d32f2f;
    font-size: 12px;
}

.no-products {
    padding: 10px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.product-results {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.product-item {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    background-color: white;
}

.product-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.product-info {
    padding: 10px;
}

.product-info h6 {
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.product-price {
    font-size: 14px;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 3px;
}

.product-availability {
    font-size: 11px;
    color: #666;
}

/* Mobile responsive for product results */
@media (max-width: 768px) {
    .product-results {
        flex-direction: column;
    }
    
    .product-item {
        max-width: 100%;
        min-width: auto;
    }
    
    .product-image {
        height: 100px;
    }
    
    .battery-search-section h6,
    .motx-search-section h6 {
        font-size: 13px;
    }
}

/* MotX Integration Styles */
.no-motx-products {
    padding: 10px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.motx-search-error {
    padding: 10px;
    color: #d32f2f;
    font-size: 12px;
}

.motx-results {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.motx-battery-item {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    background-color: white;
    border-left: 4px solid #2e7d32;
}

.motx-battery-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.motx-battery-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.motx-battery-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
}

.motx-battery-image:before {
    content: "🔋";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #2e7d32;
    display: none;
}

.motx-battery-image:error,
.motx-battery-image[src=""],
.motx-battery-image[src="#"] {
    background-color: #f8f9fa;
    border: 2px dashed #2e7d32;
    position: relative;
}

.motx-battery-image:error:before,
.motx-battery-image[src=""]:before,
.motx-battery-image[src="#"]:before {
    display: block;
}

.motx-image-placeholder {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border: 2px dashed #2e7d32;
    border-radius: 4px;
    font-size: 24px;
    color: #2e7d32;
    font-weight: bold;
}

.motx-battery-info {
    padding: 10px;
}

.motx-battery-info h6 {
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.motx-dimensions {
    font-size: 11px;
    color: #666;
    margin-bottom: 3px;
}

.motx-price {
    font-size: 14px;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 3px;
}

.motx-compatible {
    font-size: 11px;
    color: #1976d2;
    margin-bottom: 3px;
    font-weight: 500;
}

.motx-cross-refs {
    font-size: 10px;
    color: #666;
    line-height: 1.2;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #f0f0f0;
}

/* Mobile responsive for MotX results */
@media (max-width: 768px) {
    .motx-results {
        flex-direction: column;
    }
    
    .motx-battery-item {
        max-width: 100%;
        min-width: auto;
    }
    
    .motx-battery-image {
        height: 100px;
    }
}

/* MotX section distinctive styling */
.motx-search-section {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.motx-search-section h6::before {
    content: "🔋 ";
    margin-right: 5px;
}

/* MotX Results Table */
.motx-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.motx-results-table th,
.motx-results-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.motx-results-table th {
    background-color: #2e7d32;
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.motx-results-table tbody tr:hover {
    background-color: #f8f9fa;
}

.motx-results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Buy button styles */
.buy-button {
    display: inline-block;
    padding: 6px 16px;
    background-color: #2e7d32;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
    border: none;
    cursor: pointer;
    text-align: center;
}

.buy-button:hover {
    background-color: #1b5e20;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.buy-button:active {
    transform: translateY(0);
}

.motx-results-table .motx-article {
    font-weight: 600;
    color: #2e7d32;
}

.motx-results-table .motx-polarity {
    color: #1976d2;
    font-weight: 500;
}

.motx-results-table .motx-capacity {
    font-weight: 500;
    color: #333;
}

.motx-results-table .motx-dimensions {
    font-family: monospace;
    font-size: 12px;
    color: #666;
}

.motx-results-table .motx-type,
.motx-results-table .motx-series {
    color: #666;
    font-size: 12px;
}

.motx-results-table .motx-cca,
.motx-results-table .motx-weight,
.motx-results-table .motx-season {
    color: #666;
    font-size: 12px;
}

.motx-results-table .motx-compatible {
    color: #388e3c;
    font-size: 12px;
}

.motx-results-table .motx-price {
    text-align: right;
    font-weight: 600;
    color: #2e7d32;
}

.motx-results-table .motx-buy-column {
    text-align: center;
    width: 100px;
}

/* Mobile responsive for MotX table */
@media (max-width: 768px) {
    .motx-results-table {
        font-size: 11px;
    }
    
    .motx-results-table th,
    .motx-results-table td {
        padding: 8px 4px;
    }
    
    .motx-results-table th {
        font-size: 10px;
    }
    
    .motx-results-table .motx-dimensions {
        font-size: 10px;
    }
}

/* Very small screens - stack table */
@media (max-width: 600px) {
    .motx-results-table,
    .motx-results-table thead,
    .motx-results-table tbody,
    .motx-results-table th,
    .motx-results-table td,
    .motx-results-table tr {
        display: block;
    }
    
    .motx-results-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .motx-results-table tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 4px;
        background: white;
    }
    
    .motx-results-table td {
        border: none;
        position: relative;
        padding-left: 50% !important;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    
    .motx-results-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #2e7d32;
        font-size: 11px;
    }
    
    /* Buy button mobile styles */
    .buy-button {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
        display: block;
    }
}

/* Product catalog integration styles */
.battery-products-section,
.motx-products-section {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.battery-products-section h6,
.motx-products-section h6 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.battery-products-section h6::before {
    content: "🛒 ";
    margin-right: 5px;
}

.motx-products-section h6::before {
    content: "🔋 ";
    margin-right: 5px;
}

.model-products,
.motx-model-products {
    margin-bottom: 20px;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.model-products:last-child,
.motx-model-products:last-child {
    margin-bottom: 0;
}

.model-products strong,
.motx-model-products strong {
    display: block;
    margin-bottom: 10px;
    color: #0073aa;
    font-size: 13px;
}

.product-grid,
.motx-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.product-card {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    background-color: white;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.product-card.motx-product {
    border-left: 4px solid #2e7d32;
}

.product-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.product-card .product-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    background-color: #f5f5f5;
}

.product-card .product-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .product-info h6 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    flex: 1;
}

.product-card .product-price {
    font-size: 14px;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 4px;
}

.product-card .product-availability {
    font-size: 11px;
    color: #666;
    margin-top: auto;
}

.motx-item {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #2e7d32;
}

.motx-item:last-child {
    margin-bottom: 0;
}

.motx-model-name {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 10px;
    font-size: 14px;
}

.no-products {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
    background-color: #f5f5f5;
    border-radius: 4px;
    border: 1px dashed #ccc;
}

/* Mobile responsive for product catalog */
@media (max-width: 768px) {
    .product-grid,
    .motx-product-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .battery-products-section,
    .motx-products-section {
        padding: 10px;
        margin-top: 10px;
    }
    
    .model-products,
    .motx-model-products {
        padding: 8px;
        margin-bottom: 15px;
    }
    
    .product-card .product-image {
        height: 100px;
    }
    
    .product-card .product-info {
        padding: 8px;
    }
    
    .product-card .product-info h6 {
        font-size: 12px;
    }
    
    .motx-item {
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .motx-model-name {
        font-size: 13px;
    }
}

/* Small screens - horizontal layout for product cards */
@media (max-width: 480px) {
    .product-card {
        flex-direction: row;
        height: auto;
    }
    
    .product-card .product-image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }
    
    .product-card .product-info {
        padding: 8px;
        flex: 1;
    }
    
    .product-card .product-info h6 {
        font-size: 11px;
        margin-bottom: 4px;
    }
    
    .product-card .product-price {
        font-size: 12px;
    }
    
    .product-card .product-availability {
        font-size: 10px;
    }
}

/* Enhanced loading states */
.battery-products-results .loading,
.motx-products-results .loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.battery-products-results .loading::before,
.motx-products-results .loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Error states for product sections */
.battery-products-results .error,
.motx-products-results .error {
    padding: 15px;
    text-align: center;
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    font-size: 13px;
}

/* Success animation for loaded products */
.product-card {
    animation: slideInUp 0.3s ease-out;
}

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

/* Stagger animation for multiple products */
.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }