:root {
    --bg-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --accent: #2563eb; /* Industrial Blue */
    --accent-glow: rgba(37, 99, 235, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --panel-glow: rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects for Light Theme */
.glass-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at top right, #ffffff 0%, #f1f5f9 100%);
    z-index: -2;
}

.glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    animation: drift 20s infinite alternate linear;
}

/* Professional Tech Blue tones matching INOVANCE devices */
.glowing-blue {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, #93c5fd, transparent 70%);
}

.glowing-purple {
    bottom: -10%; right: -10%;
    width: 40vw; height: 40vw;
    background: radial-gradient(circle, #cbd5e1, transparent 70%);
    animation-delay: -5s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 1s ease-out;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

header h1 span {
    background: none;
    -webkit-text-fill-color: inherit;
    color: var(--accent);
}

@keyframes titleBlink {
    0%, 100% { 
        color: #ffffff; 
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 20px rgba(255, 255, 255, 0.6), 2px 2px 8px rgba(0,0,0,0.5); 
    }
    50% { 
        color: var(--text-primary); 
        text-shadow: 2px 2px 2px rgba(0,0,0,0.15); 
    }
}

.blink-shadow-text {
    color: var(--text-primary); 
    animation: titleBlink 3s infinite ease-in-out;
}

.blink-shadow-text span {
    color: var(--accent) !important;
    text-shadow: inherit;
}

header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    animation: fadeInUp 0.6s ease-out both;
    box-shadow: 0 10px 25px rgba(0,0,0,0.03);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(234, 88, 12, 0.15), 0 0 20px var(--accent-glow);
}

.card-img-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f8fafc; /* Light grey instead of dark */
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Better for product photos on white */
    transition: transform 0.5s ease;
    mix-blend-mode: multiply; /* Helps integrate white backgrounds */
}

.product-card:hover .card-img-wrapper img {
    transform: scale(1.1);
}

.card-content {
    padding: 20px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Updated badge colors for light theme */
.badge.inverter { color: #0284c7; background: rgba(2, 132, 199, 0.15); }
.badge.servo { color: #ea580c; background: rgba(234, 88, 12, 0.15); }
.badge.plc { color: #16a34a; background: rgba(22, 163, 74, 0.15); }

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Softer overlay */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #ffffff; /* White modal */
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.1);
    max-height: 90vh;
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 20px; right: 25px;
    color: var(--text-secondary);
    font-size: 32px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s, background 0.2s;
    background: rgba(0,0,0,0.05); /* Light circle */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover { color: #000; background: rgba(0,0,0,0.1); }

.modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
        overflow-y: visible;
    }
}

.modal-image-container {
    flex: 1;
    background: #f8fafc;
    min-height: 250px;
    display: flex;
    align-items: center;
}

.modal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.modal-info {
    flex: 1.2;
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.modal-info h2 {
    font-size: 2rem;
    margin: 10px 0 15px;
    color: var(--text-primary);
}

.modal-info p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.specs {
    margin-bottom: 30px;
    flex-grow: 1;
}

.specs ul {
    list-style: none;
}

.specs li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05); /* Darker border for light mode */
    display: flex;
    justify-content: space-between;
}

.specs li span:first-child { color: var(--text-secondary); }
.specs li span:last-child { font-weight: 600; text-align: right; color: var(--text-primary); }

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: #c2410c; /* Darker orange */
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Selection Tool Container */
.selection-tool {
    animation: fadeInUp 0.5s ease-out;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.glass-panel-ui {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); /* Softer shadow */
}

.glass-panel-ui h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    color: var(--text-primary);
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.filter-item select {
    background: #ffffff; /* White background for select */
    color: var(--text-primary);
    border: 1px solid #cbd5e1; /* Subtle grey border */
    padding: 12px 15px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    appearance: none;
    /* Use dark grey arrow for light background */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23475569%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

.filter-item select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.filter-item select option {
    background: #ffffff;
    color: var(--text-primary);
}

.btn-secondary {
    background: #ffffff; /* White */
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: var(--accent);
    color: var(--accent);
}

/* Results Table */
.table-responsive {
    overflow-x: auto;
}

#results-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

#results-table th, #results-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05); /* Darker border for light theme */
}

#results-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

#results-table tr {
    transition: background 0.3s;
}

#results-table tbody tr:hover {
    background: rgba(0,0,0,0.02); /* Very subtle hover on white */
}

.code-highlight {
    color: #1d4ed8; /* Darker blue for code in light theme, better contrast */
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    header h1 { font-size: 2.5rem; }
    .specs li { flex-direction: column; gap: 5px; }
    .specs li span:last-child { text-align: left; }
    .filter-group { grid-template-columns: 1fr; }
    .filter-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .search-box, .search-box input {
        width: 100%;
    }
}

/* Quantity Control Spinner */
.qty-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}
.qty-btn {
    background: #f1f5f9;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
    color: #475569;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:hover {
    background: #e2e8f0;
}
.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.qty-input {
    width: 45px;
    height: 28px;
    text-align: center;
    border: none;
    border-left: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    -moz-appearance: textfield;
}
.qty-input:focus {
    outline: none;
    background: #f8fafc;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
