:root {
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --text-main: #1a202c;
    --text-muted: #718096;
    --primary: #FF4081;
    --primary-hover: #E91E63;
    --border-col: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    --success: #38a169;
    --danger: #e53e3e;
    --header-bg: #ffffff;
}

body.dark-mode {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #f7fafc;
    --text-muted: #a0aec0;
    --primary: #FF4081;
    --primary-hover: #F50057;
    --border-col: #2d3748;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --header-bg: #1a1a1a;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    padding-top: 90px;
    padding-bottom: 40px;
}

.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 70px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-col);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: background-color 0.3s;
}

.header-left { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 1.8rem; color: var(--primary); }
.logo-text { font-weight: 800; font-size: 1.25rem; display: flex; }
.mobile-title { display: none; margin-left: 5px; color: var(--primary); }
.header-controls { display: flex; gap: 8px; align-items: center; }

@media (max-width: 600px) { 
    .desktop-title { display: none !important; }
    .mobile-title { display: inline-block !important; }
}

.icon-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; width: 36px; height: 36px; border-radius: 50%;
}
.icon-btn:hover { background: var(--border-col); color: var(--text-main); }
.lang-text { font-size: 0.95rem; font-weight: 800; font-family: 'Nunito', sans-serif; }

.text-btn {
    background: var(--border-col); border: none; border-radius: 20px;
    padding: 6px 14px; font-family: inherit; font-weight: 700; font-size: 0.9rem;
    color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 6px;
    transition: all 0.2s;
}
.text-btn:hover { background: var(--text-muted); color: var(--card-bg); }
.text-btn.active-admin { background: var(--primary); color: white; }

.container { max-width: 900px; margin: 0 auto; padding: 0 15px; }

.card {
    background: var(--card-bg); border-radius: 20px; padding: 20px;
    box-shadow: var(--shadow); border: 1px solid var(--border-col);
    margin-bottom: 24px; transition: background-color 0.3s, border-color 0.3s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 15px 40px rgba(0,0,0,0.12); }

/* Views & Landing */
.method-cards { display: flex; flex-direction: column; gap: 15px; }
.method-card {
    background: var(--bg-color); border: 2px solid var(--border-col);
    border-radius: 16px; padding: 20px; display: flex; align-items: center; gap: 18px;
    cursor: pointer; transition: all 0.25s; position: relative; overflow: hidden;
}
.method-card:hover:not(.disabled) {
    border-color: var(--primary); transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(255, 64, 129, 0.15);
}
.method-card.disabled { opacity: 0.6; cursor: not-allowed; border-style: dashed; filter: grayscale(0.5); }
.method-card .icon-wrap {
    width: 50px; height: 50px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
    flex-shrink: 0;
}
.method-card h3 { font-size: 1.1rem; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.method-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

/* Admin Method Card Specifics */
.admin-method-card {
    border-color: rgba(255, 64, 129, 0.3);
    background: linear-gradient(145deg, var(--card-bg), rgba(255, 64, 129, 0.05));
}
.admin-method-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(255, 64, 129, 0.2);
}

.back-btn {
    background: none; border: none; color: var(--text-muted); font-size: 0.95rem;
    font-weight: 700; display: flex; align-items: center; gap: 6px; cursor: pointer;
    margin-bottom: 15px; transition: color 0.2s; padding: 0; font-family: inherit;
}
.back-btn:hover { color: var(--text-main); }
.back-btn ion-icon { font-size: 1.2rem; }

#calculator-form { display: flex; flex-direction: column; gap: 20px; }
.input-group { display: flex; flex-direction: column; gap: 8px; }

label { font-weight: 700; font-size: 0.9rem; color: var(--text-main); }

input, select {
    width: 100%; padding: 14px 16px; border-radius: 12px;
    border: 1px solid var(--border-col); background: var(--bg-color);
    color: var(--text-main); font-family: inherit; font-size: 1rem;
    outline: none; transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--primary); }

.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon ion-icon { position: absolute; left: 14px; font-size: 1.2rem; color: var(--text-muted); }
.input-with-icon input { padding-left: 44px; }
.input-with-icon input { width: 100%; border: none; padding: 12px 14px 12px 42px; font-family: inherit; font-size: 0.95rem; background: transparent; }
.input-with-icon input:focus { outline: none; }

.prefix-wrapper { display: flex; align-items: center; background: var(--bg-color); border: 1px solid var(--border-col); border-radius: 10px; overflow: hidden; }
.prefix-wrapper .prefix { padding: 0 10px; color: var(--text-muted); font-weight: 700; background: rgba(0,0,0,0.05); font-size: 0.85rem; }
.prefix-wrapper input { border: none !important; border-radius: 0 !important; flex: 1; margin-top: 0; }

.select-wrapper { position: relative; }
.select-wrapper::after {
    content: '▼'; position: absolute; right: 16px; top: 50%;
    transform: translateY(-50%); font-size: 0.7rem; color: var(--text-muted); pointer-events: none;
}
select { -webkit-appearance: none; appearance: none; padding-right: 40px; }

.divider {
    display: flex; align-items: center; color: var(--text-muted);
    font-size: 0.9rem; font-weight: 700; margin: 15px 0 5px 0;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border-col);
}
.divider::before { margin-right: 10px; }
.divider::after { margin-left: 10px; }

/* Settings Grid - Mobile First */
.settings-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 15px; 
    margin-top: 15px;
}
@media (min-width: 600px) { 
    .settings-grid { grid-template-columns: 1fr 1fr; } 
}

/* Admin Card & Mode Selector */
.admin-card {
    border-top: 4px solid var(--primary);
}
.admin-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-col);
}

.admin-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    margin-bottom: 15px;
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none; /* Firefox */
}
.admin-mode-selector::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.admin-mode-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-color);
    border: 1px solid var(--border-col);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.admin-mode-pill:hover {
    background: var(--border-col);
    color: var(--text-main);
}
.admin-mode-pill ion-icon {
    font-size: 1.1rem;
}

/* Active Mode Pill Standard */
.admin-mode-pill.active {
    background: var(--text-main);
    color: var(--card-bg);
    border-color: var(--text-main);
}
/* Active Mode Pill "Tous" (All) - Red/Accent */
.admin-mode-pill.all-mode.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}


.actions { display: flex; gap: 15px; margin-top: 10px; }
button {
    font-family: inherit; font-size: 1rem; font-weight: 700;
    border-radius: 12px; padding: 14px; cursor: pointer; border: none;
    display: flex; justify-content: center; align-items: center; transition: all 0.2s;
}
.primary-btn { background: var(--primary); color: white; flex: 1; position: relative;}
.primary-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }
.secondary-btn { background: var(--border-col); color: var(--text-main); }
.secondary-btn:hover { background: var(--text-muted); color: var(--card-bg); }

.spinner {
    display: none; width: 22px; height: 22px;
    border: 3px solid rgba(255,255,255,0.3); border-top: 3px solid white;
    border-radius: 50%; animation: spin 1s linear infinite; position: absolute;
}
.primary-btn.loading { color: transparent; pointer-events: none; }
.primary-btn.loading .btn-text { opacity: 0; }
.primary-btn.loading .spinner { display: block; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Currency Toggle Pill */
.currency-toggle {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.items-count {
    font-size: 0.9rem; font-weight: 700; color: var(--text-muted);
}
.toggle-pills {
    display: flex; border: 1px solid var(--border-col); border-radius: 10px;
    overflow: hidden; background: var(--bg-color);
}
.pill {
    padding: 6px 16px; font-size: 0.85rem; font-weight: 800;
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; transition: all 0.2s; font-family: inherit;
    border-radius: 0;
}
.pill.active {
    background: var(--primary); color: white;
}
.pill:hover:not(.active) {
    background: var(--border-col); color: var(--text-main);
}

/* Product Results Section */
.section-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 20px; color: var(--text-main); }

.results-layout { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 768px) {
    .results-layout { flex-direction: row; }
    .items-list-container { flex: 2; height: 600px; overflow-y: auto; padding-right: 10px;}
    .summary-panel { flex: 1; position: sticky; top: 90px; align-self: start; }
}

.items-list-container::-webkit-scrollbar { width: 6px; }
.items-list-container::-webkit-scrollbar-thumb { background: var(--border-col); border-radius: 4px;}

.product-card {
    display: flex; gap: 15px; padding: 12px;
    background: var(--bg-color); border: 1px solid var(--border-col);
    border-radius: 16px; margin-bottom: 12px; transition: all 0.3s;
    position: relative;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.product-card.removing {
    opacity: 0; transform: translateX(-100%); max-height: 0;
    padding: 0 12px; margin-bottom: 0; overflow: hidden;
}

.product-image {
    width: 90px; height: 110px; border-radius: 10px; overflow: hidden; background: var(--border-col); flex-shrink: 0;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }

.product-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.product-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;}
.product-name { font-weight: 700; font-size: 0.95rem; line-height: 1.3; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}
.product-link { color: var(--primary); font-size: 1.2rem; }

.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.current-price { font-size: 1.15rem; font-weight: 800; color: var(--text-main); }
.orig-price { font-size: 0.85rem; text-decoration: line-through; color: var(--text-muted); }
.discount-tag { font-size: 0.75rem; background: rgba(229, 62, 62, 0.1); color: var(--danger); padding: 3px 6px; border-radius: 6px; font-weight: 800;}

/* Quantity & Remove Controls */
.product-controls {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; gap: 10px;
}

.qty-control {
    display: flex; align-items: center; gap: 0;
    border: 1px solid var(--border-col); border-radius: 10px;
    overflow: hidden; background: var(--bg-color);
}
.qty-btn {
    width: 32px; height: 32px; padding: 0;
    background: var(--border-col); border: none; border-radius: 0;
    color: var(--text-main); font-size: 1.1rem; font-weight: 800;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.qty-btn:hover { background: var(--primary); color: white; }
.qty-value {
    width: 36px; text-align: center; font-weight: 800; font-size: 0.95rem;
    color: var(--text-main); background: transparent; border: none;
    font-family: inherit; padding: 0; line-height: 32px;
}

.remove-btn {
    background: none; border: none; padding: 4px 8px;
    color: var(--danger); font-size: 1.1rem; cursor: pointer;
    border-radius: 8px; transition: all 0.2s;
    display: flex; align-items: center; gap: 4px; font-weight: 700;
}
.remove-btn:hover { background: rgba(229, 62, 62, 0.1); }
.remove-btn span { font-size: 0.8rem; }

/* Summary Panel */
.summary-panel h3 { font-size: 1.1rem; margin-bottom: 15px; border-bottom: 1px solid var(--border-col); padding-bottom: 15px;}
.summary-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.summary-row.total-margin { color: var(--primary); font-weight: 800; padding: 10px 0; border-top: 1px dashed var(--border-col); border-bottom: 1px dashed var(--border-col); }
.summary-row.bold { color: var(--text-main); font-weight: 800; }
.grand-total-box {
    margin-top: 20px; background: rgba(255, 64, 129, 0.05); border: 1px solid rgba(255, 64, 129, 0.2);
    border-radius: 16px; padding: 20px; text-align: center; display: flex; flex-direction: column; gap: 5px;
}
.grand-total-box span:first-child { color: var(--primary); font-weight: 800; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px;}
.total-value { font-size: 2rem; font-weight: 800; color: var(--text-main); }

/* Removed Items Section */
.removed-items-section {
    margin-top: 20px; padding-top: 16px;
    border-top: 2px dashed var(--border-col);
}
.removed-header {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.9rem; font-weight: 700; color: var(--text-muted);
    margin-bottom: 12px;
}
.removed-header ion-icon { font-size: 1rem; }

.removed-card {
    opacity: 0.5; filter: grayscale(70%);
    border-style: dashed !important;
    transition: opacity 0.2s, filter 0.2s;
}
.removed-card:hover {
    opacity: 0.8; filter: grayscale(30%);
    border-color: var(--success) !important;
    transform: none;
}

.restore-btn {
    background: none; border: none; padding: 4px 10px;
    color: var(--success); font-size: 1rem; cursor: pointer;
    border-radius: 8px; transition: all 0.2s;
    display: flex; align-items: center; gap: 5px; font-weight: 700;
    font-family: inherit;
}
.restore-btn:hover { background: rgba(56, 161, 105, 0.1); }
.restore-btn span { font-size: 0.85rem; }

/* Order Section */
.order-section {
    margin-top: 20px; padding-top: 20px;
    border-top: 1px solid var(--border-col);
    display: flex; flex-direction: column; gap: 14px;
}
.order-section .input-group { margin-bottom: 0; }
.order-section .input-with-icon ion-icon { color: #E1306C; }

.order-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 14px; border-radius: 12px;
    font-weight: 800; font-size: 1rem; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.25s; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}
.order-btn:active { transform: translateY(0); }
.order-btn ion-icon { font-size: 1.3rem; }

/* Order Confirmation Modal */
.order-confirmation-modal { text-align: center; max-width: 500px; }
.order-success-icon { font-size: 3.5rem; color: var(--success); margin-bottom: 10px; }
.order-success-icon ion-icon { font-size: 3.5rem; }
.order-confirm-text { color: var(--text-muted); margin: 8px 0 16px 0; font-size: 0.95rem; line-height: 1.5; }

.order-preview {
    background: var(--bg-color); border: 1px solid var(--border-col);
    border-radius: 12px; padding: 14px; text-align: left;
    font-size: 0.85rem; line-height: 1.6; color: var(--text-main);
    max-height: 250px; overflow-y: auto; white-space: pre-wrap;
    font-family: 'Nunito', sans-serif; margin-bottom: 8px;
}
.order-preview::-webkit-scrollbar { width: 4px; }
.order-preview::-webkit-scrollbar-thumb { background: var(--border-col); border-radius: 4px; }

.order-confirmation-modal .modal-actions { justify-content: center; }
.order-confirmation-modal .primary-btn { gap: 6px; }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
    display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px);
}
.modal {
    background: var(--card-bg); width: 90%; max-width: 400px; padding: 25px; border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); animation: popIn 0.3s ease-out;
}
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal h3 { margin-bottom: 20px; font-size: 1.2rem; font-weight: 800;}
.modal-actions { display: flex; gap: 15px; margin-top: 25px; }

/* Toast */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #333; color: white; padding: 12px 24px; border-radius: 30px;
    font-weight: 700; font-size: 0.95rem; opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.26, 1.55);
    z-index: 1000; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* File Upload Zone */
.file-drop-area { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; border: 2px dashed var(--border-col); border-radius: 16px; background: var(--bg-color); cursor: pointer; transition: all 0.2s; text-align: center; }
.file-drop-area:hover, .file-drop-area.dragover { border-color: var(--primary); background: rgba(255, 64, 129, 0.03); }
.file-drop-area .drop-icon { font-size: 3rem; color: var(--primary); margin-bottom: 10px; }
.file-drop-area .drop-msg { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); }
.file-drop-area input[type='file'] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-preview-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.image-preview { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border-col); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
