/* --- GLOBAL VARIABLES (Moved to :root to ensure Modals have access) --- */
:root {
    --primary-color: #5600ab;
    --primary-dark: #410082;
    --secondary-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #6c757d;
    --success-color: #00b09b;
    --success-dark: #059669; 
    --error-color: #e53e3e;
    --input-grey-bg: #f8fafc;
    --box-radius: 1rem;
}

/* --- COMPACT LAYOUT LOGIC --- */
#sales-manager-app {
    font-family: 'Varela Round', sans-serif !important;
    color: var(--text-main);
    padding-bottom: 5rem;
    background-color: var(--secondary-bg);
}

/* --- NEW MODERN HERO SECTION --- */
.hero-wrapper-full {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: var(--secondary-bg);
}

/* UPDATED: Height 280px for desktop */
.hero-collage-container {
    width: 100%;
    height: 280px; /* Updated from 420px */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Equal columns */
    grid-template-rows: 1fr;
    gap: 0;
    margin-bottom: 0;
    border-radius: 0;
    overflow: hidden;
}

/* UPDATED: Shorter fade height for "not so long" effect */
.hero-fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px; /* Reduced for shorter fade */
    background: linear-gradient(to bottom, rgba(248, 249, 250, 0) 0%, rgba(248, 249, 250, 1) 100%);
    pointer-events: none; 
    z-index: 2;
}

.collage-item {
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
    width: 100%;
    height: 100%;
}

.collage-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% center !important; /* UPDATED: Changed to 50% center to move left */
    transition: transform 0.5s ease;
}

/* Subtle zoom effect on hover */
.collage-item:hover img {
    transform: scale(1.03);
    filter: none !important;
}

/* Main Content Container Overlap - Adjusted for new height */
.content-overlap-container {
    position: relative;
    margin-top: -60px; 
    z-index: 10;
    padding-bottom: 2rem;
}

/* --- Existing Styles Adjusted --- */
#main-title {
    font-size: 3rem; 
    font-weight: 800;
    color: #000000; /* UPDATED: Changed from primary-color to black */
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    margin-top: 1rem;
    /* Animation setup */
    transition: opacity 0.6s ease, transform 0.6s ease;
    opacity: 1;
    transform: translateY(0);
}

/* State for fading out text */
#main-title.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

.hero-subtitle {
    font-size: 1.15rem;
    color: #4a5568;
    max-width: 500px;
    margin: 0 auto 1.5rem auto;
    line-height: 1.5;
}

/* STEP INDICATOR */
.step-indicator {
    display: flex; 
    justify-content: center;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 10px;
}
.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s ease;
}
.step-dot.active {
    background: var(--primary-color);
    width: 30px;
    border-radius: 10px;
}
.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#sales-manager-app .form-control,
#sales-manager-app .form-select {
    height: calc(1.5em + .5rem + 2px) !important;
    padding: .25rem .75rem !important;
    font-size: .875rem !important;
    border-radius: 6px !important;
    background-color: var(--input-grey-bg) !important;
    border: 1px solid #e2e8f0 !important;
}

#sales-manager-app textarea.form-control {
    height: auto !important;
    min-height: 80px;
    padding: 10px !important;
}

#sales-manager-app label {
    margin-bottom: 0.15rem;
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
}

/* UPDATED: Attention Bump Animation (Scale only, no color change) */
@keyframes attentionBump {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
    }
    100% { 
        transform: scale(1); 
    }
}

/* Default state (Visible) */
.anim-label {
    opacity: 1; 
    display: inline-block; /* Required for transform to work nicely */
    transform-origin: left center;
    transition: color 0.3s ease;
}

/* Waiting state: Hidden until animation starts */
.anim-label.waiting {
    opacity: 1; /* Changed to 1 so it's always visible */
}

/* Active state: Plays the attention animation */
.anim-label.active {
    animation: attentionBump 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#sales-manager-app .universal-box,
#sales-manager-app .card {
    background: #ffffff !important;
    padding: 2rem !important;
    border-radius: var(--box-radius) !important;
    /* Softer shadow for floating effect */
    box-shadow: 0 20px 40px rgba(0,0,0,0.08) !important; 
    border: none !important;
    margin-bottom: 1.5rem;
}

/* Updated Title Style: Always Centered */
.form-section-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    margin-top: 1.5rem;
    padding-bottom: 0;
    border-bottom: none !important;
    text-align: center !important; /* Force center alignment */
}

/* RANGE SLIDER DESIGN */
.slider-container {
    padding: 20px 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; 
}
.slider-value-display {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 5px;
}
.custom-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px; 
    border-radius: 10px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    display: block;
    margin: 0;
    border: none !important;
}

.custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.1s ease;
    margin-top: -8px; 
    position: relative;
    z-index: 2;
}

.custom-range-slider::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border: 2px solid var(--primary-color);
}

.custom-range-slider:focus { outline: none; }

.custom-range-slider:active::-webkit-slider-thumb {
    transform: scale(1.1);
    background-color: #fcfaff;
}

/* STEPPER & BOX */
.stepper-box-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #fcfaff;
    border-radius: 12px;
    border: 1px dashed #d6bcfa;
    transition: all 0.3s ease;
    text-align: center;
}

.custom-profit-container {
    display: none; 
    background: #fdfbff; 
    border: 2px solid var(--primary-color);
    border-style: solid;
    box-shadow: 0 4px 15px rgba(86, 0, 171, 0.05);
}

.stepper-controls, .profit-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 8px;
    width: 100%;
}

/* Original stepper button (small) */
.btn-stepper {
    width: 48px;
    height: 48px;
    min-width: 48px; 
    min-height: 48px; 
    flex-shrink: 0; 
    border-radius: 50% !important;
    border: 2px solid var(--primary-color);
    background: #fff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    outline: none !important;
    touch-action: manipulation;
}

/* NEW: Larger Stepper Button for Modal */
.btn-stepper-modal {
    width: 64px;
    height: 64px;
    min-width: 64px; 
    min-height: 64px;
    flex-shrink: 0; 
    border-radius: 50% !important;
    border: 2px solid var(--primary-color);
    background: #ffffff !important; /* Explicit white background */
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: 0 4px 10px rgba(86,0,171,0.15);
    outline: none !important;
    touch-action: manipulation;
}
.btn-stepper-modal:hover {
    background-color: #f3f0fa !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(86,0,171,0.25);
}
.btn-stepper-modal svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
}

.large-stepper-input {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    height: auto !important;
    outline: none !important;
    box-shadow: none !important; 
    -webkit-tap-highlight-color: transparent;
}

.large-stepper-input:focus, .large-stepper-input:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.large-members-input { width: 100px; }

.large-profit-input { 
    width: auto; 
    min-width: 50px;
    max-width: 350px;
    color: var(--primary-color); 
    display: inline-block;
    border: none !important;
    background: transparent !important;
    outline: none !important;
}

.kr-label-custom { color: #4a5568 !important; }
.error-feedback { color: var(--error-color); font-size: 0.75rem; margin-top: 4px; display: none; font-weight: 600; animation: shake 0.4s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.product-item { margin-bottom: 10px !important; }

/* Updated Product Row Design */
.product-compact-row {
    display: flex;
    flex-direction: row; /* Horizontal */
    align-items: center;
    padding: 12px;
    background: #fff;
    border: 2px solid transparent; /* Prepare for selected state border */
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.product-compact-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.product-compact-row.selected-row {
    border-color: var(--primary-color);
    background-color: #f3f0fa;
}

/* Image Wrapper */
.product-img-wrapper {
    position: relative;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Image */
.product-img-mini {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 4px !important; 
    object-fit: cover;
    border: 1px solid #f1f1f1;
    background: #fff;
    margin: 0; /* Wrapper handles spacing */
    display: block;
}

/* Read More Badge - Inline in Text Column */
.read-more-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary-color);
    background-color: #f3f0fa;
    padding: 3px 12px;
    border-radius: 20px;
    margin-top: 6px;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    align-self: flex-start; /* Align left in flex container */
    border: 1px solid rgba(86, 0, 171, 0.1);
    transition: all 0.2s ease;
    text-decoration: none;
}
.read-more-badge:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(86,0,171,0.15);
}

/* Remove Product Badge - Same Design but for Delete */
.remove-product-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--error-color); /* Red text */
    background-color: #fff5f5; /* Light red bg */
    padding: 3px 12px;
    border-radius: 20px;
    margin-top: 8px; /* Slightly more margin to separate from stats text */
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: 1px solid rgba(229, 62, 62, 0.1);
    transition: all 0.2s ease;
    text-decoration: none;
}
.remove-product-badge:hover {
    background-color: var(--error-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(229, 62, 62, 0.15);
}

/* Info Section */
.product-info-mini {
    flex: 1; /* Take remaining space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 10px; /* Space for checkbox if tight */
    overflow: hidden;
}

.product-name-mini {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-main);
    line-height: 1.2;
}

.product-desc-mini { font-size: 0.75rem; color: #6c757d; line-height: 1.2; margin-top: 2px; font-weight: 500; }

.profit-text-simple { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-top: 3px; }
.profit-text-simple .highlight-profit { color: var(--success-dark); font-weight: 800; }

/* Checkbox Section - Right Aligned */
.product-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 10px;
    /* Ensure no background circle here */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Custom Checkbox Look */
.product-select-cb {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary-color);
    transform: scale(1.1);
    /* Ensure no unwanted background */
    background-color: transparent !important;
    box-shadow: none !important;
    appearance: auto;
}

/* --- UPDATED: Results Grid for 3 Columns --- */
.results-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* 3 items side-by-side */
    gap: 12px; 
    margin-bottom: 1.5rem; 
}
@media (max-width: 768px) { 
    .results-grid { grid-template-columns: 1fr; } /* Stack on mobile/tablet */
}

/* METRIC CARDS */
.metric-card {
    background: #fff;
    border: 1px solid #edf2f7;
    padding: 18px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}
.metric-card.accent { background: #f3f0fa; border-color: #d6bcfa; }
.metric-card.accent .metric-value { color: var(--primary-color); }

.metric-card.success { background: #f0fff4; border-color: #c6f6d5; }
.metric-card.success .metric-value { color: var(--success-dark); }

/* Interaction for metric cards (clickable difficulty) */
.metric-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

/* NEW: Difficulty Metric Colors */
.metric-card.warning { background: #fffaf0; border-color: #fbd38d; }
.metric-card.warning .metric-value { color: #dd6b20; } /* Orange */

.metric-card.warning-dark { background: #fff5eb; border-color: #f6ad55; }
.metric-card.warning-dark .metric-value { color: #c05621; } /* Darker Orange */

.metric-card.danger { background: #fff5f5; border-color: #fc8181; }
.metric-card.danger .metric-value { color: #e53e3e; } /* Red */

.metric-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.metric-value { font-size: 1.35rem; font-weight: 800; color: var(--text-main); line-height: 1.2; display: flex; align-items: center; justify-content: center; }

/* NEW: Info Icon for Modal */
.info-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1); /* Semi-transparent dark */
    color: #4a5568;
    font-size: 13px;
    margin-left: 8px;
    cursor: pointer;
    vertical-align: middle;
    font-weight: 700;
    transition: all 0.2s;
}
.info-icon-btn:hover {
    background: rgba(0,0,0,0.2);
    transform: scale(1.1);
}

.goal-circle-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 2rem auto;
}
.goal-circle-svg { transform: rotate(-90deg); width: 160px; height: 160px; }
.goal-circle-bg { fill: none; stroke: #f1f5f9; stroke-width: 10; }
.goal-circle-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.goal-circle-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}
.circle-val { font-size: 2.2rem; font-weight: 900; color: var(--primary-color); display: block; line-height: 1; }
.circle-label { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-top: 4px; display: block; }

.calculation-table-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}
.calc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.calc-table td { padding: 12px 15px; border-bottom: 1px solid #e2e8f0; color: var(--text-main); }
.calc-table tr:last-child td { border-bottom: none; }
.calc-table .label { font-weight: 500; color: var(--text-muted); }
.calc-table .value { text-align: right; font-weight: 700; }

/* NEW: Small Edit Badge Style */
.edit-badge-small {
    display: inline-block;
    background-color: #f3f0fa;
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 1px solid rgba(86, 0, 171, 0.1);
    vertical-align: middle;
}
.edit-badge-small:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(86,0,171,0.2);
}

.breakdown-item-detailed {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.breakdown-top-row { display: flex; align-items: center; gap: 15px; }
.breakdown-product-img { width: 70px; height: 70px; object-fit: cover; border-radius: 10px; background: #f8fafc; border: 1px solid #eee; flex-shrink: 0; }
.breakdown-summary-info { flex-grow: 1; }
.breakdown-product-name { font-weight: 800; font-size: 0.95rem; color: var(--text-main); margin: 0; }
.breakdown-simple-stats { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.profit-green { color: var(--success-dark) !important; font-weight: 800; }

.toggle-expand-btn {
    width: 32px; height: 32px; border-radius: 50%; background: #f3f0fa; color: var(--primary-color);
    display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; font-size: 1.2rem; font-weight: bold;
    flex-shrink: 0; /* Ensures it stays circular */
    line-height: 1; /* Centers symbol vertically */
    padding: 0; /* Removes padding to prevent offset */
}

.breakdown-full-explain {
    display: none; margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0;
    font-size: 0.88rem; line-height: 1.6; color: var(--text-muted);
}
.math-highlight { color: var(--success-dark); font-weight: 700; }

.btn-primary-custom, .btn-back-custom {
    height: 52px !important; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    text-decoration: none !important; 
    border-radius: 10px !important; 
    transition: all 0.3s ease; 
    font-weight: 700 !important;
    cursor: pointer;
    padding: 0 34px !important;
}
.btn-primary-custom { background-color: var(--primary-color) !important; border: none; color: white !important; font-size: 1rem; }
.btn-primary-custom:hover { background-color: var(--primary-dark) !important; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(86, 0, 171, 0.25); }
.btn-back-custom { background-color: #fff !important; border: 1px solid #e2e8f0 !important; color: var(--text-muted) !important; font-size: 0.95rem; }

/* SECONDARY BUTTON CUSTOM (For Modals) */
.btn-secondary-custom {
    background-color: #fff !important;
    border: 1px solid #e2e8f0 !important;
    color: #6c757d !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    padding: 0 20px !important;
    height: 45px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-secondary-custom:hover {
    background-color: #f8f9fa !important;
    color: #4a5568 !important;
    border-color: #cbd5e1 !important;
}

/* Modal specific tweaks */
/* --- UPDATED: Modals with generous padding & border radius --- */
.modal-content {
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
    overflow: hidden !important;
}

/* UPDATED: Reduced padding and added scrollable max-height logic */
.modal-body {
    padding: 2rem 1.25rem !important; /* Less side padding (was 2.5rem) */
    max-height: 60vh; /* Consistent max-height for scrolling */
    overflow-y: auto; /* Enable scroll */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on mobile */
}

/* Fix specific modals if needed */
#editMembersModal .modal-footer-custom {
    display: flex;
    gap: 10px;
    padding-top: 10px;
}
#editMembersModal .btn {
    flex: 1; /* Equal width buttons */
}

.custom-cb-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 15px;
    margin-bottom: 25px;
    padding: 1.25rem;
    background: #fcfaff;
    border: 2px solid #e9d8fd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-align: left;
}
.custom-cb-container:hover { border-color: var(--primary-color); background: #f3f0fa; }
.custom-cb-container.checked { border-color: var(--primary-color); background: #f3f0fa; box-shadow: 0 4px 12px rgba(86, 0, 171, 0.08); }

.styled-checkbox {
    appearance: none; -webkit-appearance: none;
    width: 24px; height: 24px; min-width: 24px;
    border: 2px solid #cbd5e1; border-radius: 6px;
    background: #fff; margin-right: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; position: relative;
}
.styled-checkbox:checked { background: var(--primary-color); border-color: var(--primary-color); }
.styled-checkbox:checked::after {
    content: ""; width: 6px; height: 11px; border: solid white;
    border-width: 0 3px 3px 0; transform: rotate(45deg);
    position: absolute; top: 3px;
}
.custom-cb-container label { margin: 0; cursor: pointer; font-size: 0.9rem !important; color: var(--text-main) !important; font-weight: 600 !important; line-height: 1.4; }

.step-container { display: none; }
.step-container.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.action-button-group { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 2rem; margin-bottom: 2rem; }

#productDetailModal .modal-content { border-radius: 20px; border: none; overflow: hidden; }
/* Override the generic modal-body if product modal needs specifically more bottom padding */
/* UPDATED: Reduced side padding here as well */
#productDetailModal .modal-body { padding: 1.5rem 1.25rem 2rem 1.25rem !important; }

/* UPDATED: Hero Image Styles - Full Width Side-to-Side */
#modalImg { 
    width: 100% !important; 
    height: 250px; /* Default height */
    max-width: none !important; /* Remove constraint */
    margin: 0 !important; 
    border-radius: 0 !important; 
    display: block; 
    object-fit: cover !important; 
}

/* --- NEW ADJUSTMENT BUTTON STYLES --- */
.btn-adjust-distribution {
    background-color: #fff;
    border: 2px solid #e2e8f0;
    color: var(--text-main);
    font-weight: 700;
    border-radius: 12px;
    padding: 10px 24px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn-adjust-distribution:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #fcfaff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* --- ADJUSTMENT MODAL STYLES --- */
.adjustment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.adjust-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
}

.adjust-info {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.adjust-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    flex-shrink: 0;
    font-size: 1.2rem;
}

.adjust-label {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.2;
    margin-right: 8px; /* Added */
}

.adjust-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 5px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
}

.adjust-btn-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    font-weight: 800;
    font-size: 1.3rem;
    line-height: 1;
    user-select: none;
}

.adjust-btn-circle:hover {
    border-color: var(--primary-color);
    background: #f3f0fa;
    transform: scale(1.05);
}

.adjust-input {
    width: 40px;
    text-align: center;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-main);
    border: none;
    background: transparent;
    padding: 0;
    outline: none;
}

/* Mobile tweak for adjustment row */
@media (max-width: 480px) {
    .adjust-row {
        padding: 12px 10px;
    }
    .adjust-label {
        font-size: 0.9rem;
    }
    .adjust-icon {
        width: 32px; 
        height: 32px;
        font-size: 1rem;
    }
    .adjust-controls {
        gap: 8px;
        padding: 4px;
    }
    .adjust-btn-circle {
        width: 30px;
        height: 30px;
        font-size: 1.1rem;
    }
    .adjust-input {
        width: 30px;
        font-size: 1.1rem;
    }
}


/* --- LARGE SCREEN CONSTRAINT FOR RESULT PAGE (Step 3), STEP 1 AND STEP 2 --- */
/* Updated to include #step2 for side spacing */
@media (min-width: 1200px) {
    #step3, #step1 {
        max-width: 980px; /* UPDATED: 980px width */
        margin-left: auto;
        margin-right: auto;
    }

    /* Product select specific width */
    #step2 {
        max-width: 1070px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* LARGE SCREEN PRODUCT STYLING */
    .product-img-mini { 
        width: 108px !important; /* UPDATED */
        height: auto !important; /* UPDATED */
        min-width: auto !important; /* UPDATED */
    }
    
    .product-name-mini { font-size: 1.1rem !important; }
    .product-desc-mini { font-size: 0.9rem !important; }
    .profit-text-simple { font-size: 0.9rem !important; }
    .product-compact-row { padding: 15px !important; }

    /* Specific tweak for first collage image (Merino) on large screens */
    /* UPDATED: Changed to use width/height instead of scale to prevent load animation bug */
    .collage-item:first-child img {
        width: 170% !important;
        height: 170% !important;
        max-width: none !important;
        
        /* Positioning to match "50% center" request + "move down" */
        margin-left: -70%; /* UPDATED: Changed to -70% to move more left */
        margin-top: -8%;  /* UPDATED: Changed to -8% to move more down */
        
        transform: none !important; /* No initial scale */
        object-position: center center !important; 
        transition: transform 0.5s ease;
    }

    /* Ensure hover works: Scale slightly from the new base size */
    .collage-item:first-child:hover img {
        transform: scale(1.03) !important; 
    }
}

/* --- SIDE BY SIDE LAYOUT FOR LARGE SCREENS (1400px+) --- */
@media (min-width: 1400px) {
    .step1-desktop-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        align-items: stretch; /* Stretch items to same height */
        margin-bottom: 1.5rem;
    }
    .step1-column {
        display: flex;
        flex-direction: column;
    }
    .step1-column .stepper-box-container {
        flex: 1; /* Grow to fill column height */
        height: auto; /* Allow flex to control height */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    /* Ensure custom goal container doesn't break the flex flow but stays compact */
    #customGoalContainer {
        margin-top: 15px !important;
        margin-bottom: 0 !important;
        flex: 0; /* Don't stretch this one, let the top one stretch or just sit */
    }
}

/* --- NEW: Specific rules for screens smaller than 1200px (Tablet & Mobile) --- */
@media (max-width: 1199.98px) {
    .collage-item img {
        width: 120%;
        height: 120%;
        object-fit: cover;
        object-position: 90% center !important;
        transition: transform 0.5s ease;
    }
}

/* --- MOBILE STYLES (Overrides everything else) --- */
@media (max-width: 768px) {
    /* MERGED: Button layout overrides */
    .action-button-group { 
        flex-direction: column-reverse !important; 
        gap: 10px !important; 
    }
    .btn-primary-custom {
        width: 100% !important;
    }
    /* 5. Product Row Reordering (Mobile: Img -> Text -> Checkbox) */
    /* Move text to the middle (Order 2) */
    .product-info-mini {
        order: 2 !important;
        padding-right: 10px !important; /* Add space between text and checkbox */
    }

    /* Move checkbox to the end (Order 3) */
    .product-checkbox-wrapper {
        order: 3 !important;
        padding-left: 0 !important;
        padding-right: 0 !important; /* Align to right edge */
    }

    /* Ensure Image stays first (Order 1) */
    .product-img-wrapper {
        order: 1 !important;
    }

    /* UPDATED: More space top and bottom AND sides (10px horizontal) */
    .product-compact-row {
        padding: 16px 10px !important; 
    }

    /* UPDATED: Larger picture in mobile view (90px) */
    .product-img-mini {
        width: 90px !important; /* Increased from 75px */
        height: 90px !important; 
        min-width: 90px !important;
    }

    /* MERGED: General mobile fixes */
    #sales-manager-app .universal-box,
    #sales-manager-app .card {
        padding: 1rem !important;
    }
    
    #sales-manager-app input[type="text"],
    #sales-manager-app input[type="number"],
    #sales-manager-app input[type="email"],
    #sales-manager-app input[type="tel"],
    #sales-manager-app textarea,
    #sales-manager-app .form-control,
    #sales-manager-app .form-select {
        font-size: 16px !important;
    }

    #sales-manager-app .slider-value-display, 
    #sales-manager-app input[type="number"].large-stepper-input,
    #sales-manager-app input[type="text"].large-stepper-input {
        font-size: 35px !important; 
        line-height: 1.2 !important;
        height: auto !important;
    }

    /* Reduce container padding on mobile to allow content to go wider */
    .content-overlap-container {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-top: -60px; /* Adjusted overlap for mobile */
    }
    
    /* UPDATED: Reduced main title font size for mobile */
    #main-title { font-size: 1.8rem; }
    
    .hero-subtitle { font-size: 1rem; }
    /* Mobile Modal Hero Height */
    #modalImg { max-height: 200px !important; }
    
    #customGoalInput::placeholder { font-size: 1rem !important; }
    
    .product-name-mini { padding-right: 0 !important; }
    .btn-primary-custom, .btn-back-custom {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }
    .action-button-group button:last-child { margin-bottom: 0 !important; }

    /* REORDERING & SIZING PRODUCT ROW FOR MOBILE */
    .product-compact-row {
        padding: 10px 0 !important; /* Vertical padding only */
        background: transparent !important; /* REMOVED BACKGROUND CARD */
        box-shadow: none !important; /* REMOVED SHADOW */
        border: none !important; /* REMOVED BORDER */
        border-bottom: 1px solid #edf2f7 !important; /* Subtle separator */
        border-radius: 0 !important;
    }
    
    .product-item {
        margin-bottom: 0 !important; /* No margin between items */
    }
    
    .product-compact-row.selected-row {
        background-color: transparent !important; /* No bg change on select */
        border-bottom-color: #edf2f7 !important; /* Keep default border color */
    }
    
    /* Image first, smaller */
    .product-img-wrapper {
        order: 1;
        margin-right: 12px !important;
    }
    
    /* Checkbox second (after picture), tighter spacing */
    .product-checkbox-wrapper {
        order: 2;
        padding-left: 0 !important;
        padding-right: 10px;
        flex-shrink: 0;
    }
    
    /* SMALLER CHECKBOX REQUEST */
    .product-select-cb {
        width: 18px !important;
        height: 18px !important;
    }

    /* Text last, smaller font */
    .product-info-mini {
        order: 3;
        padding-right: 0 !important;
    }
    
    .product-name-mini {
        font-size: 0.85rem !important;
    }
    
    .read-more-badge {
        font-size: 0.65rem;
        padding: 2px 10px;
    }
    
    .hero-collage-container {
        grid-template-columns: 1fr; /* 1 Column */
        height: 380px !important; /* UPDATED: Mobile height 380px */
    }
    
    /* Hide 2nd and 3rd images on mobile */
    .collage-item:nth-child(2),
    .collage-item:nth-child(3) {
        display: none !important;
    }

    .hero-fade-overlay {
        height: 100px; /* Shorter fade for mobile */
    }

    /* Adjust slider handle position for mobile/iPhone */
    .custom-range-slider::-webkit-slider-thumb {
        margin-top: -2px !important; /* Moved down to -2px */
    }

    /* --- NEW: BUTTON ADJUSTMENT MOBILE OVERRIDE --- */
    /* Make "Juster fordeling" and "Endre produkter" smaller on mobile */
    .btn-adjust-distribution {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
        height: auto !important;
        gap: 6px !important;
    }
    .btn-adjust-distribution svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* --- NEW: BUTTON ICON STYLING & ANIMATION --- */
/* Force increased spacing between text and icon, and animate */
.btn-primary-custom svg, 
.btn-back-custom svg {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Next/Action Buttons (Icon on right) */
.btn-primary-custom svg {
    margin-left: 18px !important; /* Increased spacing */
}

/* Back Buttons (Icon on left) */
.btn-back-custom svg {
    margin-right: 18px !important; /* Increased spacing */
    margin-left: 0 !important;
}

/* NEW: Secondary/PDF Button - Add specific margin to icon */
.btn-secondary-custom svg {
    margin-right: 12px !important;
}

/* Hover Effects */
.btn-primary-custom:hover svg {
    transform: translateX(6px);
}

.btn-back-custom:hover svg {
    transform: translateX(-6px);
}