/**
 * Biteship Shipping Module - Frontend Styles
 *
 * v1.1.3: compact single-line courier rows (~52px instead of ~110px). The old
 * always-rendered gray "details" strip is removed; informative descriptions
 * render as a small note line inside the row (see biteship-rates.js
 * getDeliveryNote). This file is the ONLY style source — display_carrier_extra.tpl
 * must not carry an inline copy.
 *
 * v1.1.8: courier logos — official art in views/img/couriers/{code}.png,
 * injected by biteship-rates.js at the start of the row head (and the
 * selected-courier panel). Wordmark logos vary in aspect; height is fixed,
 * width capped, object-fit keeps them proportional without growing the row.
 *
 * @author Kharisma Catur Mandala
 * @version 1.1.8
 */

/* Base Styles */
.biteship-carrier-selection {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Loading State */
.biteship-loading {
    text-align: center;
    padding: 40px 20px;
}

.biteship-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2c3e50;
    border-radius: 50%;
    animation: biteship-spin 1s linear infinite;
}

@keyframes biteship-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.biteship-loading-text {
    color: #666;
    font-size: 14px;
}

/* Error State */
.biteship-error {
    text-align: center;
    padding: 30px 20px;
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    color: #c53030;
}

.biteship-error-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    color: #c53030;
}

.biteship-error-message {
    margin: 10px 0;
    font-size: 14px;
}

.biteship-retry-btn {
    margin-top: 15px;
    padding: 8px 20px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.biteship-retry-btn:hover {
    background-color: #34495e;
}

/* Header */
.biteship-header {
    margin-bottom: 12px;
}

.biteship-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.biteship-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Courier List — compact rows */
.biteship-courier-list {
    margin-bottom: 12px;
}

.biteship-courier-item {
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: white;
    animation: biteship-fadeIn 0.3s ease-out;
}

.biteship-courier-item:last-child {
    margin-bottom: 0;
}

.biteship-courier-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.biteship-courier-item.selected {
    border-color: #3182ce;
    background-color: #ebf8ff;
}

.biteship-courier-item input[type="radio"] {
    display: none;
}

.biteship-courier-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 14px;
    cursor: pointer;
}

/* Custom radio dot (the native input is hidden) */
.biteship-courier-radio-dot {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e0;
    border-radius: 50%;
    box-sizing: border-box;
}

.biteship-courier-item.selected .biteship-courier-radio-dot {
    border-color: #3182ce;
    background-color: #3182ce;
    box-shadow: inset 0 0 0 3px #fff;
}

.biteship-courier-main {
    flex: 1;
    min-width: 0;
}

.biteship-courier-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 6px;
    row-gap: 2px;
}

.biteship-courier-name {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

/* Courier logo (v1.1.8) — sits at the start of the row head, inline with
   name/service/eta. align-self for the flex row head; vertical-align for the
   selected-courier panel where it renders inside a text div. */
.biteship-courier-logo {
    height: 18px;
    width: auto;
    max-width: 60px;
    object-fit: contain;
    flex: 0 0 auto;
    align-self: center;
    vertical-align: middle;
    margin-right: 6px;
}

.biteship-courier-service {
    font-size: 13px;
    color: #666;
}

.biteship-courier-eta {
    font-size: 12px;
    color: #94a3b8;
}

.biteship-courier-eta:not(:empty)::before {
    content: "·";
    margin-right: 6px;
    color: #cbd5e0;
}

/* Real delivery notes (e.g. min-weight restrictions) — small second line */
.biteship-courier-note {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #718096;
}

.biteship-courier-note:empty {
    display: none;
}

.biteship-courier-price {
    font-size: 15px;
    font-weight: 700;
    color: #27ae60;
    white-space: nowrap;
}

/* Feature badges — inline in the head line, not a separate strip */
.biteship-courier-features {
    display: inline-flex;
    gap: 4px;
}

.biteship-courier-features:empty {
    display: none;
}

.biteship-feature {
    padding: 1px 6px;
    background-color: #e2e8f0;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    color: #4a5568;
}

.biteship-feature.same-day {
    background-color: #c6f6d5;
    color: #276749;
}

.biteship-feature.express {
    background-color: #bee3f8;
    color: #2c5282;
}

.biteship-feature.economy {
    background-color: #fef5e7;
    color: #7c6f16;
}

/* Footer */
.biteship-footer {
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.biteship-disclaimer {
    font-size: 12px;
    color: #718096;
    font-style: italic;
}

/* Selected Courier Display */
.biteship-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #ebf8ff;
    border: 1px solid #3182ce;
    border-radius: 8px;
}

.biteship-selected-info {
    flex: 1;
}

.biteship-selected-courier {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.biteship-selected-price {
    font-size: 16px;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 4px;
}

.biteship-selected-eta {
    font-size: 12px;
    color: #666;
}

.biteship-change-btn {
    padding: 8px 16px;
    background-color: #3182ce;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.biteship-change-btn:hover {
    background-color: #2c5282;
}

/* Animations */
@keyframes biteship-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design — rows stay single-line and wrap naturally; only the
   selected-courier panel and Change button need stacking. */
@media (max-width: 768px) {
    .biteship-selected {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .biteship-change-btn {
        width: 100%;
    }
}

/* Legacy support for old carrier option styles */
.biteship-carrier-option {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.biteship-carrier-option:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.biteship-carrier-option.selected {
    border-color: #007bff;
    background-color: #e7f3ff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.biteship-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px;
    border-radius: 4px;
    margin: 15px 0;
}

/* Tracking information styles (for future implementation) */
.biteship-tracking-info {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
}

.biteship-tracking-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: #007bff;
}

.biteship-tracking-status {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.biteship-tracking-status:last-child {
    border-bottom: none;
}

.biteship-tracking-date {
    font-weight: bold;
    color: #495057;
}

.biteship-tracking-description {
    margin-top: 5px;
    color: #6c757d;
}

/* Phone-guard warning (TASK-013): flash pulse after a blocked delivery-step
   Continue. Class is added/removed by biteship-phone-guard.js; base banner
   styling comes from core .alert-warning. */
@keyframes biteship-phone-warning-flash {
    0%, 100% { background-color: #fff3cd; }
    50% { background-color: #ffeeba; box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.35); }
}

.biteship-phone-warning-flash {
    animation: biteship-phone-warning-flash 0.7s ease-in-out 3;
}
