/**
 * استایل فرانت‌اند افزونه پیگیری سفارشات عطر مهدی
 * سازگار با قالب وودمارت و راست‌چین
 * Version: 1.0.0
 */

:root {
    --atm-primary: #1a73e8;
    --atm-primary-dark: #1557b0;
    --atm-success: #27ae60;
    --atm-warning: #f39c12;
    --atm-danger: #e74c3c;
    --atm-bg: #f8f9fc;
    --atm-card-bg: #ffffff;
    --atm-text: #2d3748;
    --atm-text-light: #718096;
    --atm-border: #e2e8f0;
    --atm-radius: 12px;
    --atm-radius-sm: 8px;
    --atm-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --atm-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --atm-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    --atm-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.atm-tracking-wrapper * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.atm-tracking-wrapper {
    max-width: 720px;
    margin: 30px auto;
    padding: 0 15px;
    font-family: inherit;
    direction: rtl;
    text-align: right;
}

/* هدر */
.atm-tracking-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.atm-tracking-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    background: linear-gradient(135deg, var(--atm-primary), #4f8ef7);
    border-radius: 24px;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(26, 115, 232, 0.25);
}

.atm-tracking-icon svg {
    width: 44px;
    height: 44px;
}

.atm-tracking-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--atm-text);
    margin: 0 0 8px;
    line-height: 1.3;
}

.atm-tracking-subtitle {
    font-size: 14px;
    color: var(--atm-text-light);
    margin: 0;
    line-height: 1.6;
}

/* فرم */
.atm-tracking-form {
    background: var(--atm-card-bg);
    padding: 28px;
    border-radius: var(--atm-radius);
    box-shadow: var(--atm-shadow-md);
    border: 1px solid var(--atm-border);
}

.atm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
}

@media (max-width: 600px) {
    .atm-form-row {
        grid-template-columns: 1fr;
    }
}

.atm-field {
    display: flex;
    flex-direction: column;
}

.atm-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--atm-text);
    margin-bottom: 8px;
}

.atm-field-icon {
    display: inline-flex;
    color: var(--atm-primary);
}

.atm-field-icon svg {
    width: 18px;
    height: 18px;
}

.atm-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--atm-border);
    border-radius: var(--atm-radius-sm);
    font-size: 15px;
    color: var(--atm-text);
    background: #fff;
    transition: var(--atm-transition);
    font-family: inherit;
}

.atm-field input:focus {
    outline: none;
    border-color: var(--atm-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.atm-field input::placeholder {
    color: #a0aec0;
}

/* دکمه ارسال */
.atm-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--atm-primary), var(--atm-primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--atm-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--atm-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.3);
}

.atm-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

.atm-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.atm-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.atm-btn-text,
.atm-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.atm-btn-text svg {
    width: 18px;
    height: 18px;
}

.atm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: atm-spin 0.8s linear infinite;
}

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

.atm-form-hint {
    text-align: center;
    font-size: 12px;
    color: var(--atm-text-light);
    margin: 14px 0 0;
    line-height: 1.6;
}

/* نتیجه */
.atm-tracking-result {
    margin-top: 24px;
    animation: atm-fade-up 0.4s ease-out;
}

@keyframes atm-fade-up {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.atm-result-card {
    background: var(--atm-card-bg);
    border-radius: var(--atm-radius);
    box-shadow: var(--atm-shadow-lg);
    border: 1px solid var(--atm-border);
    overflow: hidden;
}

.atm-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8f9fc, #fff);
    border-bottom: 1px solid var(--atm-border);
    flex-wrap: wrap;
    gap: 12px;
}

.atm-result-order-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.atm-order-label {
    font-size: 14px;
    color: var(--atm-text-light);
}

.atm-order-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--atm-text);
}

.atm-result-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.atm-result-status-badge .dashicons,
.atm-result-status-badge svg {
    width: 16px;
    height: 16px;
}

/* تایم‌لاین */
.atm-timeline {
    padding: 32px 24px 28px;
    position: relative;
}

.atm-timeline-line {
    position: absolute;
    top: 50%;
    right: 12%;
    left: 12%;
    height: 4px;
    background: var(--atm-border);
    border-radius: 2px;
    transform: translateY(-12px);
    z-index: 0;
}

.atm-timeline-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.atm-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
}

.atm-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--atm-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--atm-text-light);
    font-weight: 600;
    font-size: 14px;
    transition: var(--atm-transition);
    margin-bottom: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.atm-step.completed .atm-step-circle {
    color: #fff;
    border-color: transparent;
    transform: scale(1.05);
}

.atm-step.current .atm-step-circle {
    transform: scale(1.15);
    box-shadow: 0 0 0 5px rgba(26, 115, 232, 0.15);
    animation: atm-pulse 2s infinite;
}

@keyframes atm-pulse {
    0%, 100% { box-shadow: 0 0 0 5px rgba(26, 115, 232, 0.15); }
    50%      { box-shadow: 0 0 0 8px rgba(26, 115, 232, 0.05); }
}

.atm-step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--atm-text);
    line-height: 1.3;
    max-width: 80px;
}

.atm-step:not(.completed) .atm-step-label {
    color: var(--atm-text-light);
}

.atm-step-time {
    font-size: 10px;
    color: var(--atm-text-light);
    margin-top: 4px;
}

/* موبایل - تایم‌لاین عمودی */
@media (max-width: 600px) {
    .atm-timeline {
        padding: 20px 16px;
    }
    .atm-timeline-line {
        top: 20px;
        bottom: 20px;
        right: 24px;
        left: auto;
        width: 4px;
        height: auto;
        transform: none;
    }
    .atm-timeline-steps {
        flex-direction: column;
        align-items: flex-end;
        gap: 20px;
    }
    .atm-step {
        flex-direction: row;
        align-items: center;
        text-align: right;
        gap: 12px;
        width: 100%;
    }
    .atm-step-circle {
        margin-bottom: 0;
        flex-shrink: 0;
        order: -1;
        z-index: 2;
    }
    .atm-step-label {
        max-width: none;
        flex: 1;
    }
    .atm-step-time {
        margin-top: 0;
    }
}

/* توضیحات وضعیت */
.atm-status-description {
    padding: 16px 24px;
    background: rgba(26, 115, 232, 0.04);
    border-top: 1px solid var(--atm-border);
    border-bottom: 1px solid var(--atm-border);
}

.atm-status-description p {
    margin: 0;
    color: var(--atm-text);
    font-size: 14px;
    line-height: 1.6;
}

/* یادداشت */
.atm-note-box {
    margin: 16px 24px;
    padding: 12px 16px;
    background: #fff8e1;
    border-right: 4px solid var(--atm-warning);
    border-radius: var(--atm-radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7a5a00;
    font-size: 13px;
}

.atm-note-box .dashicons {
    color: var(--atm-warning);
    flex-shrink: 0;
}

/* جعبه اطلاعات رهگیری */
.atm-tracking-info-box {
    margin: 16px 24px;
    padding: 18px;
    background: #f0f7ff;
    border-radius: var(--atm-radius-sm);
    border: 1px solid #d0e3ff;
}

.atm-tracking-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #c0d8f0;
    flex-wrap: wrap;
    gap: 8px;
}

.atm-tracking-info-row:last-child {
    border-bottom: none;
}

.atm-info-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--atm-text);
    font-size: 14px;
    font-weight: 600;
}

.atm-info-label svg {
    color: var(--atm-primary);
    width: 18px;
    height: 18px;
}

.atm-info-value {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.atm-company-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.atm-tracking-code {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--atm-text);
    background: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--atm-border);
    letter-spacing: 1px;
    user-select: all;
}

.atm-track-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--atm-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: var(--atm-transition);
}

.atm-track-link:hover {
    color: var(--atm-primary-dark);
    text-decoration: underline;
}

.atm-track-link svg {
    width: 14px;
    height: 14px;
}

/* خلاصه سفارش */
.atm-order-summary {
    padding: 16px 24px;
    background: #fafbfc;
    border-top: 1px solid var(--atm-border);
}

.atm-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.atm-summary-label {
    color: var(--atm-text-light);
}

.atm-summary-value {
    color: var(--atm-text);
    font-weight: 500;
}

.atm-summary-value.atm-amount {
    font-weight: 700;
    color: var(--atm-primary);
    font-size: 15px;
}

/* اقلام سفارش */
.atm-items-details,
.atm-history-details {
    margin: 0 24px 16px;
    border: 1px solid var(--atm-border);
    border-radius: var(--atm-radius-sm);
    overflow: hidden;
}

.atm-items-details summary,
.atm-history-details summary {
    padding: 12px 16px;
    background: #f8f9fc;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--atm-text);
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    user-select: none;
    transition: var(--atm-transition);
}

.atm-items-details summary:hover,
.atm-history-details summary:hover {
    background: #f0f2f7;
}

.atm-items-details summary::-webkit-details-marker,
.atm-history-details summary::-webkit-details-marker {
    display: none;
}

.atm-items-details summary::after,
.atm-history-details summary::after {
    content: '▼';
    margin-right: auto;
    font-size: 10px;
    color: var(--atm-text-light);
    transition: transform 0.2s;
}

.atm-items-details[open] summary::after,
.atm-history-details[open] summary::after {
    transform: rotate(180deg);
}

.atm-items-list {
    padding: 12px 16px;
}

.atm-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--atm-border);
    align-items: center;
}

.atm-item:last-child {
    border-bottom: none;
}

.atm-item-image {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--atm-border);
}

.atm-item-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.atm-item-name {
    font-size: 14px;
    color: var(--atm-text);
    font-weight: 500;
}

.atm-item-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--atm-text-light);
    align-items: center;
}

.atm-item-total {
    color: var(--atm-primary);
    font-weight: 600;
}

/* تاریخچه */
.atm-history-list {
    padding: 12px 16px;
}

.atm-history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--atm-border);
    font-size: 13px;
    flex-wrap: wrap;
    gap: 8px;
}

.atm-history-row:last-child {
    border-bottom: none;
}

.atm-history-time {
    color: var(--atm-text-light);
}

.atm-history-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--atm-text);
}

/* فوتر */
.atm-result-footer {
    padding: 16px 24px;
    background: #fafbfc;
    border-top: 1px solid var(--atm-border);
    text-align: center;
}

.atm-help-text {
    font-size: 12px;
    color: var(--atm-text-light);
    margin: 0;
    line-height: 1.6;
}

/* پیام خطا */
.atm-error-message {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-right: 4px solid var(--atm-danger);
    color: #c53030;
    padding: 14px 18px;
    border-radius: var(--atm-radius-sm);
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: atm-shake 0.4s ease;
}

.atm-error-message svg {
    width: 20px;
    height: 20px;
    color: var(--atm-danger);
    flex-shrink: 0;
}

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

/* پیام موفقیت */
.atm-success-message {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-right: 4px solid var(--atm-success);
    color: #22543d;
    padding: 14px 18px;
    border-radius: var(--atm-radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

/* سازگاری با وودمارت */
.woodmart-content-area .atm-tracking-wrapper,
.content-area .atm-tracking-wrapper {
    max-width: 720px;
    margin: 30px auto;
}

.woodmart-content-area .atm-tracking-title,
.content-area .atm-tracking-title {
    margin-top: 0;
}

/* راست‌چین اعداد در فیلدها */
.atm-field input[dir="ltr"] {
    text-align: right;
}

/* دکمه فشار داده شده */
.atm-submit-btn:active {
    transform: scale(0.98);
}

/* حالت تاریک (اختیاری) */
@media (prefers-color-scheme: dark) {
    .atm-tracking-wrapper {
        --atm-bg: #1a202c;
        --atm-card-bg: #2d3748;
        --atm-text: #f7fafc;
        --atm-text-light: #cbd5e0;
        --atm-border: #4a5568;
    }
}
