﻿/* ===================================================== */
/* File     : orders.css                                 */
/* Version  : 1.0                                         */
/* Date     : 1405/07/02 - 19:00                          */
/* Author   : Ehsan Shirsan (Ani Holding)                */
/* Path     : C:\AniProject\Source\Ani\wwwroot\css\      */
/* Purpose  : Orders Page Styles                         */
/* ===================================================== */

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --ani-green: #2d7a5f;
    --ani-green-light: #4a9d7f;
    --ani-green-dark: #1d5a45;
    --ani-green-soft: #e8f5f0;
    --ani-orange: #e67e22;
    --ani-red: #e74c3c;
    --ani-purple: #8e44ad;
    --ani-blue: #3498db;
    --ani-yellow: #f39c12;
    --ani-bg: #f4f6f8;
    --ani-bg-green: #66af91;
    --text-main: #1a1a1a;
    --text-muted: #868e96;
    --text-light: #adb5bd;
    --border: #e9ecef;
    --bg-card: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-lift: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    --header-height: 64px;
    --bottom-nav-height: 72px;
    --container-max: 480px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--ani-bg);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input {
    font-family: inherit;
}

/* ==================== HEADER ==================== */
.orders-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.header-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    transition: var(--transition);
    flex-shrink: 0;
}

    .header-btn:hover {
        background: var(--ani-green-soft);
        color: var(--ani-green);
    }

    .header-btn:active {
        transform: scale(0.95);
    }

    .header-btn svg {
        width: 22px;
        height: 22px;
    }

    .header-btn.loading svg {
        animation: spin 0.8s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== STATS ==================== */
.orders-stats {
    max-width: var(--container-max);
    margin: 16px auto 0;
    padding: 0 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card--active {
    background: linear-gradient(135deg, var(--ani-green), var(--ani-green-light));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(45, 122, 95, 0.3);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--ani-green);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-card--active .stat-value {
    color: white;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

.stat-card--active .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== FILTER TABS ==================== */
.filter-tabs {
    max-width: var(--container-max);
    margin: 16px auto 0;
    padding: 0 16px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
}

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

.filter-tab {
    padding: 8px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    border: 1.5px solid var(--border);
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .filter-tab:hover {
        border-color: var(--ani-green-light);
        color: var(--ani-green);
    }

    .filter-tab.active {
        background: linear-gradient(135deg, var(--ani-green), var(--ani-green-light));
        color: white;
        border-color: transparent;
        box-shadow: 0 4px 12px rgba(45, 122, 95, 0.3);
    }

.tab-icon {
    font-size: 0.75rem;
}

/* ==================== SEARCH ==================== */
.search-section {
    max-width: var(--container-max);
    margin: 12px auto 0;
    padding: 0 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    transition: var(--transition);
}

    .search-box:focus-within {
        border-color: var(--ani-green);
        box-shadow: 0 0 0 4px rgba(45, 122, 95, 0.1);
    }

    .search-box svg {
        width: 18px;
        height: 18px;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .search-box input {
        flex: 1;
        border: none;
        background: transparent;
        outline: none;
        font-size: 0.9rem;
        color: var(--text-main);
    }

        .search-box input::placeholder {
            color: var(--text-light);
        }

/* ==================== ORDERS CONTAINER ==================== */
.orders-container {
    max-width: var(--container-max);
    margin: 16px auto 0;
    padding: 0 16px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== SKELETON ==================== */
.skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card {
    height: 160px;
    border-radius: var(--radius-xl);
    background: linear-gradient(90deg, #f0f2f5 25%, #e9ecef 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ==================== ORDER CARD ==================== */
.order-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition-lift);
    cursor: pointer;
    position: relative;
}

    .order-card::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--ani-green), var(--ani-green-light));
    }

    .order-card.status-pending::before {
        background: linear-gradient(90deg, #95a5a6, #7f8c8d);
    }

    .order-card.status-preparing::before {
        background: linear-gradient(90deg, var(--ani-purple), #9b59b6);
    }

    .order-card.status-ontheway::before {
        background: linear-gradient(90deg, var(--ani-blue), #5dade2);
    }

    .order-card.status-delivered::before {
        background: linear-gradient(90deg, var(--ani-green), #52be80);
    }

    .order-card.status-cancelled::before {
        background: linear-gradient(90deg, var(--ani-red), #ec7063);
    }

    .order-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .order-card:active {
        transform: translateY(0) scale(0.99);
    }

/* ==================== ORDER HEADER ==================== */
.order-card-header {
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.order-number {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-main);
    direction: ltr;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-icon {
    opacity: 0.5;
    transition: var(--transition);
    font-size: 0.75rem;
}

.order-number:hover .copy-icon {
    opacity: 1;
}

/* ==================== STATUS BADGE ==================== */
.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

    .status-badge.pending {
        background: #f8f9fa;
        color: #6c757d;
    }

    .status-badge.preparing {
        background: #f4ecf7;
        color: var(--ani-purple);
    }

    .status-badge.ontheway {
        background: #eaf2f8;
        color: var(--ani-blue);
    }

    .status-badge.delivered {
        background: var(--ani-green-soft);
        color: var(--ani-green);
    }

    .status-badge.cancelled {
        background: #fdedec;
        color: var(--ani-red);
    }

/* ==================== ITEMS PREVIEW ==================== */
.order-items-preview {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-main);
}

    .preview-item .qty {
        font-weight: 800;
        color: var(--ani-green);
        min-width: 24px;
        font-size: 0.8rem;
    }

    .preview-item .name {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.more-items {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-right: 32px;
    font-style: italic;
}

/* ==================== ORDER FOOTER ==================== */
.order-card-footer {
    padding: 12px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.order-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-price {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--ani-green);
    direction: ltr;
    text-align: right;
}

.order-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ==================== ORDER ACTIONS ==================== */
.order-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 700;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

    .action-btn:active {
        transform: scale(0.95);
    }

.action-btn--primary {
    background: linear-gradient(135deg, var(--ani-green), var(--ani-green-light));
    color: white;
    box-shadow: 0 2px 8px rgba(45, 122, 95, 0.3);
}

.action-btn--secondary {
    background: #f1f3f5;
    color: #495057;
}

    .action-btn--secondary:hover {
        background: #e9ecef;
    }

/* ==================== LOAD MORE ==================== */
.load-more-sentinel {
    height: 20px;
}

.load-more-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--ani-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.end-of-list {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ==================== EMPTY / ERROR STATE ==================== */
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.empty-icon,
.error-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

.empty-state h3,
.error-state h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p,
.error-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--ani-green), var(--ani-green-light));
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(45, 122, 95, 0.3);
    transition: var(--transition);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(45, 122, 95, 0.4);
    }

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .modal-overlay.active {
        display: flex;
        opacity: 1;
    }

.modal-sheet {
    width: 100%;
    max-width: var(--container-max);
    background: white;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 12px 20px 32px;
    position: relative;
}

.modal-overlay.active .modal-sheet {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: #dee2e6;
    border-radius: 9999px;
    margin: 0 auto 20px;
}

.modal-content {
    /* JS fills this */
}

/* ==================== BOTTOM NAV ==================== */
.ani-bottom-nav {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: calc(var(--container-max) - 32px);
    margin: 0 auto;
    height: var(--bottom-nav-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    z-index: 999;
}

.nav-highlight {
    position: absolute;
    height: calc(100% - 16px);
    top: 8px;
    left: 0;
    width: 0;
    background: linear-gradient(135deg, var(--ani-green), var(--ani-green-light));
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(45,122,95,0.35);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 0;
    pointer-events: none;
    opacity: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: var(--transition-lift);
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

    .nav-item svg {
        width: 22px;
        height: 22px;
        transition: var(--transition-lift);
        stroke: currentColor;
    }

    .nav-item span {
        font-size: 0.7rem;
        font-weight: 600;
        white-space: nowrap;
        transition: var(--transition-lift);
    }

    .nav-item.active {
        color: white;
    }

        .nav-item.active svg {
            transform: scale(1.1);
            stroke: white;
        }

        .nav-item.active span {
            color: white;
        }

    .nav-item:active {
        transform: scale(0.92);
    }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 380px) {
    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .filter-tab {
        padding: 7px 12px;
        font-size: 0.75rem;
    }

    .action-btn {
        padding: 7px 10px;
        font-size: 0.72rem;
    }
}
