/* ==========================================================================
   EasyMail Courier WooCommerce - Frontend Tracking Widget
   ========================================================================== */

/* ---------- Widget Container ---------- */
.easymail-tracking-widget {
    max-width: 600px;
    margin: 30px auto;
    padding: 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1d2327;
}

.easymail-tracking-widget *,
.easymail-tracking-widget *::before,
.easymail-tracking-widget *::after {
    box-sizing: border-box;
}

.easymail-tracking-widget h3 {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: #712e7e;
    text-align: center;
}

/* ---------- Input + Button Row ---------- */
.easymail-tracking-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.easymail-tracking-form input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.easymail-tracking-form input[type="text"]:focus {
    border-color: #712e7e;
    box-shadow: 0 0 0 3px rgba(113, 46, 126, 0.15);
}

.easymail-tracking-form input[type="text"]::placeholder {
    color: #aaa;
}

.easymail-tracking-form button {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #712e7e;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.easymail-tracking-form button:hover {
    background: #5a2465;
    box-shadow: 0 2px 8px rgba(113, 46, 126, 0.3);
}

.easymail-tracking-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Results Container ---------- */
.easymail-tracking-results {
    display: none;
}

.easymail-tracking-results.has-results {
    display: block;
    animation: easymail-track-fade-in 0.3s ease;
}

@keyframes easymail-track-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Status Header ---------- */
.easymail-tracking-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f3eaf5;
    border-radius: 10px;
    margin-bottom: 20px;
}

.easymail-tracking-status-header .tracking-number {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    font-weight: 700;
    color: #5a2465;
}

.easymail-tracking-status-header .status-badge {
    display: inline-block;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.easymail-tracking-status-header .status-badge.status-pending {
    background: #fef5e7;
    color: #b7791f;
}

.easymail-tracking-status-header .status-badge.status-in_transit,
.easymail-tracking-status-header .status-badge.status-in-transit {
    background: #e8f4fd;
    color: #2471a3;
}

.easymail-tracking-status-header .status-badge.status-delivered {
    background: #eafaf1;
    color: #1e7e34;
}

.easymail-tracking-status-header .status-badge.status-returned {
    background: #fdedec;
    color: #c0392b;
}

.easymail-tracking-status-header .status-badge.status-cancelled {
    background: #f0f0f1;
    color: #787c82;
}

/* ---------- Delivery Info Section ---------- */
.easymail-tracking-delivery-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 24px;
}

.easymail-tracking-delivery-info .info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.easymail-tracking-delivery-info .info-item .info-label {
    font-size: 11px;
    font-weight: 600;
    color: #787c82;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.easymail-tracking-delivery-info .info-item .info-value {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* ---------- Timeline ---------- */
.easymail-tracking-timeline {
    position: relative;
    padding-left: 32px;
}

.easymail-tracking-timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 11px;
    bottom: 8px;
    width: 2px;
    background: #ddd;
    border-radius: 1px;
}

.easymail-tracking-timeline h4 {
    margin: 0 0 16px;
    padding-left: 0;
    margin-left: -32px;
    font-size: 14px;
    font-weight: 700;
    color: #50575e;
}

/* ---------- Checkpoint Item ---------- */
.easymail-checkpoint {
    position: relative;
    padding-bottom: 20px;
}

.easymail-checkpoint:last-child {
    padding-bottom: 0;
}

.easymail-checkpoint::before {
    content: "";
    position: absolute;
    top: 6px;
    left: -25px;
    width: 12px;
    height: 12px;
    background: #c3c4c7;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ddd;
    z-index: 1;
}

.easymail-checkpoint:first-child::before {
    background: #712e7e;
    box-shadow: 0 0 0 2px #712e7e, 0 0 0 5px rgba(113, 46, 126, 0.2);
}

.easymail-checkpoint .checkpoint-date {
    font-size: 12px;
    color: #787c82;
    margin-bottom: 2px;
}

.easymail-checkpoint .checkpoint-description {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 2px;
}

.easymail-checkpoint .checkpoint-station {
    font-size: 12px;
    color: #787c82;
    font-style: italic;
}

/* ---------- Loading Spinner ---------- */
.easymail-tracking-loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.easymail-tracking-loading.active {
    display: block;
}

.easymail-tracking-loading .spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3eaf5;
    border-top-color: #712e7e;
    border-radius: 50%;
    animation: easymail-track-spin 0.6s linear infinite;
}

.easymail-tracking-loading .loading-text {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    color: #787c82;
}

@keyframes easymail-track-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Error Message ---------- */
.easymail-tracking-error {
    display: none;
    padding: 16px 20px;
    background: #fdedec;
    border: 1px solid #f1948a;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: #c0392b;
    font-weight: 500;
}

.easymail-tracking-error.active {
    display: block;
    animation: easymail-track-fade-in 0.3s ease;
}

/* ---------- Order Detail Page Tracking ---------- */
.easymail-order-tracking-section {
    margin-top: 24px;
    padding: 20px;
    background: #f3eaf5;
    border-radius: 8px;
    border-left: 3px solid #712e7e;
}

.easymail-order-tracking-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #712e7e;
}

.easymail-order-tracking-section .tracking-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #712e7e;
    text-decoration: none;
}

.easymail-order-tracking-section .tracking-link:hover {
    text-decoration: underline;
    color: #5a2465;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .easymail-tracking-widget {
        margin: 16px;
        padding: 20px;
    }

    .easymail-tracking-widget h3 {
        font-size: 18px;
    }

    .easymail-tracking-form {
        flex-direction: column;
    }

    .easymail-tracking-form button {
        width: 100%;
    }

    .easymail-tracking-status-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .easymail-tracking-delivery-info {
        grid-template-columns: 1fr;
    }
}
