/* ==========================================================================
   AMP Model Number Locator - Styles
   ========================================================================== */

/* ---------- Reset & Base ---------- */
/* CSS custom properties are injected inline on .amp-mnl-wrapper by the PHP
   plugin based on the admin-configured accent color. Fallback values below
   ensure the tool still looks correct if the inline style is missing.       */
.amp-mnl-wrapper {
    --amp-mnl-accent: #0040b6;
    --amp-mnl-accent-rgb: 0, 64, 182;
    --amp-mnl-accent-light: #dbe6f8;
    --amp-mnl-accent-dark: #001d52;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
    box-sizing: border-box;
    line-height: 1.6;
}

.amp-mnl-wrapper *,
.amp-mnl-wrapper *::before,
.amp-mnl-wrapper *::after {
    box-sizing: border-box;
}

/* ---------- Header ---------- */
.amp-mnl-header {
    text-align: center;
    margin-bottom: 30px;
}

.amp-mnl-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--amp-mnl-accent);
    margin: 0 0 8px 0;
}

.amp-mnl-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ---------- Back Navigation ---------- */
.amp-mnl-back-nav {
    margin-bottom: 20px;
}

.amp-mnl-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--amp-mnl-accent);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.amp-mnl-back-btn:hover {
    background-color: var(--amp-mnl-accent-light);
    color: var(--amp-mnl-accent-dark);
}

.amp-mnl-back-btn svg {
    flex-shrink: 0;
}

/* ---------- Appliance Selection Grid ---------- */
.amp-mnl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.amp-mnl-grid-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 130px;
}

.amp-mnl-grid-card:hover {
    border-color: var(--amp-mnl-accent);
    background-color: var(--amp-mnl-accent-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--amp-mnl-accent-rgb), 0.15);
}

.amp-mnl-grid-card:active {
    transform: translateY(0);
}

.amp-mnl-grid-card-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
    color: var(--amp-mnl-accent);
    fill: none;
    stroke: currentColor;
}

.amp-mnl-grid-card-icon svg {
    width: 100%;
    height: 100%;
}

.amp-mnl-grid-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

/* ---------- Appliance Name (Detail View) ---------- */
.amp-mnl-appliance-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--amp-mnl-accent);
    margin: 0 0 20px 0;
    text-align: center;
}

/* ---------- Subtype Toggles ---------- */
.amp-mnl-subtypes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.amp-mnl-subtype-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 110px;
    max-width: 150px;
}

.amp-mnl-subtype-toggle:hover {
    border-color: var(--amp-mnl-accent);
    background-color: var(--amp-mnl-accent-light);
}

.amp-mnl-subtype-toggle.active {
    border-color: var(--amp-mnl-accent);
    background-color: var(--amp-mnl-accent-light);
    box-shadow: 0 0 0 1px var(--amp-mnl-accent);
}

.amp-mnl-subtype-toggle-img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.amp-mnl-subtype-toggle-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.3;
}

/* ---------- Diagram Section ---------- */
.amp-mnl-diagram-section {
    text-align: center;
}

.amp-mnl-subtype-name {
    font-size: 20px;
    font-weight: 600;
    color: #444;
    margin: 0 0 16px 0;
}

/* Two-column layout: image left, locations right */
.amp-mnl-diagram-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    text-align: left;
}

.amp-mnl-diagram-container {
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    background: #f5f5f5;
}

.amp-mnl-diagram-img {
    display: block;
    width: 330px;
    max-width: 100%;
    height: auto;
}

/* ---------- Location List ---------- */
.amp-mnl-locations {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.amp-mnl-location-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.amp-mnl-location-item:last-child {
    border-bottom: none;
}

.amp-mnl-location-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background-color: var(--amp-mnl-accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.amp-mnl-location-text {
    font-size: 15px;
    color: #444;
    padding-top: 5px;
    line-height: 1.5;
}

/* ---------- Loading State ---------- */
.amp-mnl-loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.amp-mnl-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid var(--amp-mnl-accent);
    border-radius: 50%;
    animation: amp-mnl-spin 0.8s linear infinite;
    margin: 0 auto 16px auto;
}

@keyframes amp-mnl-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .amp-mnl-wrapper {
        padding: 16px;
    }

    .amp-mnl-title {
        font-size: 22px;
    }

    .amp-mnl-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .amp-mnl-grid-card {
        padding: 16px 8px;
        min-height: 110px;
    }

    .amp-mnl-grid-card-icon {
        width: 42px;
        height: 42px;
    }

    .amp-mnl-grid-card-name {
        font-size: 12px;
    }

    .amp-mnl-appliance-name {
        font-size: 20px;
    }

    .amp-mnl-subtype-name {
        font-size: 18px;
    }

    /* Stack image above locations on tablets and below */
    .amp-mnl-diagram-layout {
        flex-direction: column;
        align-items: center;
    }

    .amp-mnl-diagram-container {
        flex-shrink: unset;
    }

    .amp-mnl-locations {
        max-width: 600px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .amp-mnl-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .amp-mnl-grid-card {
        padding: 14px 8px;
        min-height: 100px;
    }

    .amp-mnl-grid-card-icon {
        width: 36px;
        height: 36px;
    }

    .amp-mnl-grid-card-name {
        font-size: 11px;
    }

    .amp-mnl-subtypes {
        gap: 8px;
    }

    .amp-mnl-subtype-toggle {
        min-width: 90px;
        padding: 8px 10px;
    }

    .amp-mnl-subtype-toggle-img {
        width: 60px;
        height: 60px;
    }

    .amp-mnl-subtype-toggle-name {
        font-size: 11px;
    }

    .amp-mnl-location-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .amp-mnl-location-text {
        font-size: 14px;
    }
}

/* ---------- Animations ---------- */
.amp-mnl-fade-in {
    animation: amp-mnl-fadeIn 0.3s ease-in-out;
}

@keyframes amp-mnl-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
