/* styles/compare.css */

body {
    background-color: #edf1f5; /* Softer near-white */
}

main {
    max-width: 1200px;
    margin: 0.7rem auto;
    padding: 1.5rem;
   border: none;
}

.compare-category-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.category-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background: #f7f9fc; /* Neumorphic base, muted */
    color: #27c5a1;
    box-shadow: 6px 6px 12px #d8dde3, -6px -6px 12px #ffffff; /* Outset shadow */
    transition: all 0.2s ease-in-out;
}

.category-btn:hover {
    box-shadow: inset 5px 5px 10px #e3e7ec, inset -5px -5px 10px #ffffff; /* Inset shadow on hover */
    color: #ff8552; /* orange */
}

.category-btn.active {
    box-shadow: inset 5px 5px 10px #c5c8cb, inset -5px -5px 10px #ffffff; /* Deeper inset for active */
    color: #27c5a1;
    font-weight: 700;
}

.product-link {
    color: #27c5a1;  /* Using the webapp's green color */
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

/* Custom Dropdown Styles */
.custom-select {
    position: relative;
    width: 100%;
    background: #f7f9fc;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.compare-search {
    width: 100%;
    padding: 10px;
    border: none;
    border-bottom: 1px solid #ddd;
    background: #f7f9fc;
    color: #333;
    outline: none;
    font-size: 0.95rem;
    border-radius: 8px;
}

.compare-search:focus {
    border-color: #27c5a1;
}

.select-items {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #f7f9fc;
    border: 1px solid #ddd;
    border-radius: 8px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.custom-select.open .select-items {
    display: block;
}

.select-items div {
    padding: 10px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
}

.select-item {
    position: relative;
    padding: 10px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
}

.select-item:hover,
.select-item.active {
    background-color: #e6f7f3;
    color: #27c5a1;
}

.no-results,
.loading {
    padding: 10px;
    color: #777;
    text-align: center;
    font-style: italic;
}

.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.select-items div:not(.select-placeholder):hover {
    background: #27c5a1;
    color: #fff;
}

.select-items .select-placeholder {
    color: #666;
    font-style: italic;
}

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

.select-items .no-results {
    text-align: center;
    padding: 10px;
    color: #666;
    font-style: italic;
}

.select-items::-webkit-scrollbar {
    width: 8px;
}

.select-items::-webkit-scrollbar-track {
    background: #f7f9fc;
}

.select-items::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.select-items::-webkit-scrollbar-thumb:hover {
    background: #27c5a1;
}

/* Add a subtle indicator for the dropdown */
.custom-select::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.product-link:hover {
    color: #27c5a1;  /* Slightly darker shade for hover */
    text-decoration: underline;
}

.compare-card h2 {
    margin: 1rem 0;
    text-align: center;
}

.compare-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.compare-select-wrapper {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.compare-select-wrapper label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.compare-search {
    width: 60%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.compare-search:focus {
    outline: none;
    border-color: #27c5a1;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.compare-controls select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background-color: #fff;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.compare-vs-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #19e957 55%, #4eb8d8 100%);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    align-self: center;
    box-shadow: 0 4px 15px rgba(39, 197, 161, 0.4);
}

.compare-action-bar {
    text-align: center;
    margin-bottom: 2rem;
}

#compare-btn {
    padding: 0.8rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background-color: #27c5a1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#compare-btn:hover {
    background-color: #ff8552;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: start;
    justify-items: center;
}

.compare-card {
    background-color: #f7f9fc;
    border: 1px solid #e1e7ee;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 8px 8px 18px #d9dee4, -8px -8px 18px #ffffff;
    transition: box-shadow 0.2s ease, transform 0.12s ease;
    width: 100%;
    max-width: 420px;
}

.compare-card:hover { box-shadow: inset 6px 6px 14px #e3e7ec, inset -6px -6px 14px #ffffff; }

.compare-card img {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.compare-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #27c5a1; /* app green */
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    flex: 1;
    margin: 0;
}

.compare-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0.5rem;
    background: linear-gradient(135deg, #27c5a1, #1da885);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.compare-buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 197, 161, 0.3);
    background: linear-gradient(135deg, #1da885, #158a6f);
}

.compare-buy-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.compare-specs {
    text-align: left;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.spec-label {
    font-weight: 600;
    color: #333;
}

.spec-value {
    color: #333;
}

.spec-group-title {
    grid-column: 1 / -1; /* Make title span both columns */
    font-size: 1rem;
    font-weight: 700;
    color: #27c5a1;
    margin-top: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.compare-specs .spec-group-title:first-of-type {
    margin-top: 0;
}

@media (max-width: 768px) {
    .compare-controls {
        flex-direction: column;
        align-items: center;
    }

    .compare-grid {
        grid-template-columns: 1fr; /* Stack cards vertically */
    }
    .compare-grid .compare-vs-icon {
        margin: 1rem 0;
    }
    .compare-category-selector {
        flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    }
    .category-btn {
        flex: 1 1 auto; /* Allow buttons to grow and shrink */
        min-width: 120px;
    }
}