/**
 * WadeRain DealerPortal - Frontend Styles
 * Consolidated CSS for all dealer portal frontend pages
 * Edit this file to customize the appearance
 */

/* ============================================
   CHECKOUT PAGE STYLES
   ============================================ */

/* Main Container */
.dealer-checkout { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 20px; 
}
.dealer-checkout h1 { 
    margin-bottom: 30px; 
    font-size: 28px; 
}

/* Checkout Sections */
.checkout-section { 
    background: #fff; 
    border: 1px solid #e3e3e3; 
    border-radius: 8px; 
    margin-bottom: 25px; 
    overflow: hidden; 
}
.section-header { 
    background: #f5f5f5; 
    padding: 15px 20px; 
    border-bottom: 1px solid #e3e3e3; 
}
.section-header h2 { 
    margin: 0; 
    font-size: 18px; 
    color: #333; 
}
.section-header .step-number { 
    display: inline-block; 
    width: 28px; 
    height: 28px; 
    background: #1979c3; 
    color: #fff; 
    border-radius: 50%; 
    text-align: center; 
    line-height: 28px; 
    margin-right: 10px; 
    font-size: 14px; 
}
.section-content { 
    padding: 20px; 
}

/* Delivery Options */
.delivery-option { 
    display: flex; 
    align-items: flex-start; 
    padding: 15px; 
    margin-bottom: 15px; 
    border: 2px solid #e3e3e3; 
    border-radius: 6px; 
    cursor: pointer; 
    transition: all 0.2s; 
}
.delivery-option:hover { 
    border-color: #1979c3; 
}
.delivery-option.selected { 
    border-color: #1979c3; 
    background: #f0f7ff; 
}
.delivery-option input[type="radio"] { 
    margin-right: 15px; 
    margin-top: 3px; 
    transform: scale(1.3); 
}
.delivery-option .option-content { 
    flex: 1; 
}
.delivery-option .option-title { 
    font-weight: 600; 
    font-size: 16px; 
    margin-bottom: 5px; 
}
.delivery-option .option-desc { 
    color: #666; 
    font-size: 14px; 
}
.delivery-option select { 
    margin-top: 10px; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    width: 100%; 
    max-width: 400px; 
    font-size: 14px; 
}

/* Shipping Address Form */
.shipping-address-form { 
    display: none; 
    margin-top: 15px; 
    padding: 15px; 
    background: #f9f9f9; 
    border-radius: 6px; 
}
.shipping-address-form.visible { 
    display: block; 
}
.shipping-address-form .form-row { 
    margin-bottom: 15px; 
}
.shipping-address-form .form-row label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 5px; 
    font-size: 14px; 
}
.shipping-address-form .form-row input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    font-size: 14px; 
}
.shipping-address-form .form-row-inline { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
}

/* Payment Options */
.payment-option { 
    display: flex; 
    align-items: flex-start; 
    padding: 12px 15px; 
    margin-bottom: 10px; 
    border: 2px solid #e3e3e3; 
    border-radius: 6px; 
    cursor: pointer; 
    transition: all 0.2s; 
}
.payment-option:hover { 
    border-color: #1979c3; 
}
.payment-option.selected { 
    border-color: #1979c3; 
    background: #f0f7ff; 
}
.payment-option input[type="radio"] { 
    margin-right: 12px; 
    margin-top: 2px; 
    transform: scale(1.2); 
}
.payment-option .option-title { 
    font-weight: 600; 
    font-size: 15px; 
}
.payment-note { 
    background: #fff3cd; 
    border: 1px solid #ffc107; 
    padding: 12px 15px; 
    border-radius: 6px; 
    margin-top: 15px; 
    font-size: 14px; 
    color: #856404; 
}

/* Order Summary Table */
.order-summary-table { 
    width: 100%; 
    border-collapse: collapse; 
}
.order-summary-table th, 
.order-summary-table td { 
    padding: 12px 10px; 
    text-align: left; 
    border-bottom: 1px solid #e3e3e3; 
}
.order-summary-table th { 
    background: #f9f9f9; 
    font-weight: 600; 
    font-size: 13px; 
}
.order-summary-table .text-right { 
    text-align: right; 
}
.order-summary-table .text-center { 
    text-align: center; 
}
.order-summary-table .product-name { 
    font-weight: 500; 
}
.order-summary-table .product-sku { 
    color: #666; 
    font-size: 12px; 
}
.order-summary-table select.iva-select { 
    padding: 6px 8px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    font-size: 13px; 
    min-width: 100px; 
}

/* Totals Section */
.totals-section { 
    margin-top: 20px; 
    padding: 20px; 
    background: #f9f9f9; 
    border-radius: 6px; 
}
.totals-row { 
    display: flex; 
    justify-content: space-between; 
    padding: 8px 0; 
    font-size: 15px; 
}
.totals-row.subtotal { 
    border-bottom: 1px solid #ddd; 
    padding-bottom: 15px; 
}
.totals-row.iva { 
    color: #666; 
}
.totals-row.grand-total { 
    border-top: 2px solid #333; 
    padding-top: 15px; 
    margin-top: 10px; 
    font-size: 18px; 
    font-weight: 700; 
}
.exchange-rate-info { 
    text-align: right; 
    font-size: 13px; 
    color: #666; 
    margin-top: 10px; 
}

/* Submit Section */
.submit-section { 
    margin-top: 30px; 
    text-align: center; 
}
.submit-btn { 
    background: #00a751; 
    color: #fff; 
    border: none; 
    padding: 22px 60px; 
    font-size: 20px; 
    font-weight: 700; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: background 0.2s; 
    letter-spacing: 0.5px;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}
.submit-btn:hover { 
    background: #388e3c; 
}
.submit-btn:disabled { 
    background: #ccc; 
    cursor: not-allowed; 
}
.freight-note { 
    background: #e3f2fd; 
    padding: 10px 15px; 
    border-radius: 4px; 
    margin-top: 10px; 
    font-size: 13px; 
    color: #1565c0; 
}
.currency-label { 
    font-size: 0.85em; 
    color: #666; 
}

/* ============================================
   CURRENCY LABEL VIA CSS ::after
   Applied to .price elements on pages where prices
   are rendered by KnockoutJS (PDP, minicart, cart)
   or by the PHP FinalPriceBox plugin (category grids).
   
   The body class (wrdm-currency-mxn / wrdm-currency-usd)
   is set by an early inline <script> for logged-in customers.
   This approach avoids injecting HTML into strings that may
   be inserted via KO text: bindings or jQuery .text().
   ============================================ */
body.wrdm-currency-mxn .price::after {
    content: ' MXN';
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
}
body.wrdm-currency-usd .price::after {
    content: ' USD';
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
}

/* --- Exclusions: elements that should NOT get a currency label --- */

/* Nested .price elements — only the outermost gets the label.
   Prevents double labels when Magento wraps .price inside .price
   (common in cart unit prices and shipping method prices). */
body[class*="wrdm-currency-"] .price .price::after {
    content: none !important;
}

/* Exchange rate display already contains "MXN" in its text */
body[class*="wrdm-currency-"] .exchange-rate .price::after {
    content: none !important;
}

/* Price labels like "Regular Price", "Special Price" etc. */
body[class*="wrdm-currency-"] .price-label::after {
    content: none !important;
}

/* Product detail page - slightly smaller label */
body[class*="wrdm-currency-"] .product-info-main .price::after {
    font-size: 0.75em;
}

/* Category/listing page - slightly smaller label */
body[class*="wrdm-currency-"] .product-item .price::after,
body[class*="wrdm-currency-"] .product-items .price::after {
    font-size: 0.8em;
}

/* ============================================
   ORDER REQUEST LIST STYLES
   ============================================ */

/* Order Status Badges */
.order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}
.status-pending_review { background: #ffa500; color: white; }
.status-under_review { background: #1979c3; color: white; }
.status-modified_awaiting_approval { background: #ff6347; color: white; }
.status-approved { background: #32cd32; color: white; }
.status-converted { background: #008000; color: white; }
.status-cancelled { background: #808080; color: white; }

/* Unread Badge */
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    margin-left: 5px;
}
.order-row-unread {
    background-color: #fff8e1 !important;
}
.order-row-unread td:first-child {
    position: relative;
}

/* Contact Info Banner (List Page) */
.contact-info-banner {
    margin-bottom: 25px;
    padding: 0;
}
.contact-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}
.contact-card-small {
    display: flex;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 15px;
    gap: 12px;
}
.contact-card-small.branch {
    border-left: 4px solid #1979c3;
}
.contact-card-small.salesperson {
    border-left: 4px solid #28a745;
}
.contact-card-small .card-icon {
    font-size: 28px;
    line-height: 1;
}
.contact-card-small .card-content {
    flex: 1;
}
.contact-card-small .card-title {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.contact-card-small .card-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.contact-card-small .card-contact,
.contact-card-small .card-hours,
.contact-card-small .card-whatsapp {
    font-size: 13px;
    margin-bottom: 4px;
}
.contact-card-small .card-contact a,
.contact-card-small .card-whatsapp a {
    color: #1979c3;
    text-decoration: none;
}
.contact-card-small .card-contact a:hover,
.contact-card-small .card-whatsapp a:hover {
    text-decoration: underline;
}
.contact-card-small .card-whatsapp a {
    color: #25D366;
}
.contact-card-small .card-hours {
    color: #666;
}

/* ============================================
   ORDER REQUEST VIEW STYLES
   ============================================ */

/* Order Title */
.order-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}
.order-status .status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 10px;
}

/* Horizontal Info Bar */
.order-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 25px;
    background: #f9f9f9;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    align-items: center;
}
.order-info-bar .info-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.order-info-bar .info-cell .label {
    color: #666;
    font-weight: 600;
}
.order-info-bar .info-cell .value {
    color: #333;
}

/* IVA Badges */
.iva-exempt-badge {
    background: #28a745;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}
.iva-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}
.iva-badge.iva-taxable {
    background: #f8d7da;
    color: #721c24;
}
.iva-badge.iva-exempt {
    background: #d4edda;
    color: #155724;
}
.col.iva {
    text-align: center;
}
.iva.exempt .price.exempt {
    color: #28a745;
    font-weight: 600;
}

/* Delivery Address Box */
.delivery-address-box {
    background: #fff8e1;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    border-left: 4px solid #ffc107;
}

/* Order Note */
.order-note {
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #1979c3;
    margin-bottom: 20px;
}

/* Contact Info Section (View Page) */
.contact-info-section {
    margin: 30px 0;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
}
.contact-info-section .block-title {
    background: #f5f5f5;
    padding: 12px 15px;
    border-bottom: 1px solid #e3e3e3;
}
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}
.contact-card {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    overflow: hidden;
}
.contact-card .card-header {
    background: linear-gradient(135deg, #1979c3 0%, #006bb4 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.contact-card .card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.contact-card .card-icon {
    font-size: 24px;
}
.contact-card .card-body {
    padding: 20px;
}
.branch-name, 
.salesperson-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
}
.contact-item .icon {
    width: 24px;
    text-align: center;
}
.contact-item a {
    color: #1979c3;
    text-decoration: none;
}
.contact-item a:hover {
    text-decoration: underline;
}
.contact-item .label {
    font-size: 12px;
    color: #999;
    margin-left: auto;
}
.contact-item.address {
    align-items: flex-start;
}
.contact-item.whatsapp a {
    color: #25D366;
}

/* Today Hours */
.today-hours {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f0f8ff;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
}
.hours-toggle {
    margin-top: 10px;
}
.toggle-btn {
    background: none;
    border: none;
    color: #1979c3;
    cursor: pointer;
    font-size: 13px;
    padding: 5px 0;
}
.toggle-btn:hover {
    text-decoration: underline;
}
.hours-list {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}
.hours-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}
.hours-row .day {
    color: #666;
}
.hours-row .time {
    font-weight: 500;
}

/* Messages Section */
.block-messages-section {
    margin-top: 30px;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
}
.block-messages-section .block-title {
    background: #f5f5f5;
    padding: 12px 15px;
    border-bottom: 1px solid #e3e3e3;
}
.block-messages-section .block-content {
    padding: 15px;
}
.messages-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}
.no-messages {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}
.message-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}
.message-item.admin {
    background: #e3f2fd;
    margin-right: 40px;
}
.message-item.customer {
    background: #f5f5f5;
    margin-left: 40px;
}
.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}
.message-header .sender {
    color: #333;
}
.message-header .date {
    color: #999;
}
.message-body {
    font-size: 14px;
    line-height: 1.5;
}
.message-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
}
.order-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e3e3e3;
}
.subtotal-usd .price {
    color: #666;
    font-size: 0.9em;
}

/* ============================================
   SUCCESS PAGE STYLES
   ============================================ */

.order-request-success {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.success-message {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 8px;
    margin-bottom: 30px;
}

.success-message .icon-checkmark {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    font-size: 36px;
    line-height: 60px;
    margin-bottom: 15px;
}

.success-message h1 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 28px;
}

.success-message .order-number {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.success-message .order-number strong {
    font-size: 1.4em;
    color: #1b5e20;
}

.success-message .info-message {
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.order-details {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}

.order-details h2 {
    border-bottom: 2px solid #4caf50;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

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

.order-info-grid .info-item label {
    display: block;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.order-info-grid .info-item span {
    font-size: 1.1em;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
}

.status-badge.pending {
    background: #fff3e0;
    color: #e65100;
}

.delivery-address {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 25px;
}

.delivery-address h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.order-items h3 {
    margin-bottom: 15px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th,
.items-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.items-table th {
    background: #f5f5f5;
    text-align: left;
    font-weight: 600;
}

.items-table .text-right {
    text-align: right;
}

.items-table .text-center {
    text-align: center;
}

.items-table tfoot tr.totals td {
    font-size: 1.1em;
    padding-top: 10px;
}

.items-table tfoot tr.totals-usd td {
    color: #666;
    font-size: 0.95em;
    border-bottom: none;
}

.next-steps {
    background: #e3f2fd;
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.next-steps h3 {
    margin-top: 0;
    color: #1565c0;
}

.next-steps ol {
    margin: 0;
    padding-left: 20px;
}

.next-steps li {
    margin-bottom: 8px;
}

.actions-toolbar {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.actions-toolbar .action {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.actions-toolbar .action.primary {
    background: #4caf50;
    color: white;
}

.actions-toolbar .action.primary:hover {
    background: #388e3c;
}

.actions-toolbar .action.secondary {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.actions-toolbar .action.secondary:hover {
    background: #f5f5f5;
}

.error-message {
    text-align: center;
    padding: 40px;
}

/* ============================================
   HEADER NOTIFICATION BADGE
   ============================================ */

.dealer-portal-notification {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    margin-left: 10px;
    background: #1979c3;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}
.dealer-portal-notification:hover {
    background: #006bb4;
    color: #fff;
    text-decoration: none;
}
.dealer-portal-notification .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-pulse 2s infinite;
}
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
.dealer-portal-notification .icon {
    margin-right: 6px;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    .order-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .contact-cards {
        grid-template-columns: 1fr;
    }
    .message-item.admin,
    .message-item.customer {
        margin-left: 0;
        margin-right: 0;
    }
    .order-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .shipping-address-form .form-row-inline {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .contact-cards-row {
        grid-template-columns: 1fr;
    }
    .order-info-grid {
        grid-template-columns: 1fr;
    }
    .items-table {
        font-size: 0.9em;
    }
    .actions-toolbar {
        flex-direction: column;
    }
    .actions-toolbar .action {
        text-align: center;
    }
}

/* ============================================
   MINICART ICON OVERRIDE
   Replace Porto's CSS-drawn purse/bag with
   an SVG shopping cart outline.
   ============================================ */
.cart-design-2 .action.showcart .minicart-icon {
    border: none !important;
    border-radius: 0 !important;
    width: 26px !important;
    height: 26px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222529' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 002 1.61h9.72a2 2 0 002-1.61L23 6H6'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    margin: 5px 3px 0 !important;
    font-size: 0 !important;
    opacity: 1 !important;
}
.cart-design-2 .action.showcart .minicart-icon::before {
    display: none !important;
}
