/* ========================================
   Orders Management System - Styles
   Professional & Clean UI
   ======================================== */

/* CSS Variables - Softer Colors */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;

    --success-color: #22c55e;
    --success-hover: #16a34a;
    --success-light: #dcfce7;
    --success-soft: rgba(34, 197, 94, 0.85);

    --warning-color: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: #fef9c3;
    --warning-soft: rgba(245, 158, 11, 0.85);

    --info-color: #3b82f6;
    --info-hover: #2563eb;
    --info-light: #dbeafe;
    --info-soft: rgba(59, 130, 246, 0.85);

    --pending-color: #8b5cf6;
    --pending-light: #f3e8ff;
    --pending-soft: rgba(139, 92, 246, 0.85);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;

    --border-color: #e2e8f0;
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --border-radius-lg: 20px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 40px -8px rgba(0, 0, 0, 0.12), 0 8px 16px -6px rgba(0, 0, 0, 0.08);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px;
}

/* ========================================
   Header - Clean Gradient (No Triangles)
   ======================================== */
.header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    border-radius: var(--border-radius-lg);
    padding: 36px 44px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay instead of triangles */
.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    font-weight: 400;
}

/* Date aligned right, smaller */
.header-date {
    text-align: left;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 100px;
}

/* ========================================
   Stats Cards - Softer Colors, More Gap
   ======================================== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

/* Softer icon backgrounds (80% opacity) */
.stat-icon.pending {
    background: rgba(139, 92, 246, 0.12);
}

.stat-icon.confirmed {
    background: rgba(59, 130, 246, 0.12);
}

.stat-icon.on-way {
    background: rgba(245, 158, 11, 0.12);
}

.stat-icon.delivered {
    background: rgba(34, 197, 94, 0.12);
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

/* ========================================
   Filters Section - Cleaner Active State
   ======================================== */
.filters-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 18px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filters-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-btn {
    padding: 10px 18px;
    border: 2px solid transparent;
    background: var(--bg-primary);
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Strong active state - full background, white text */
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.filter-btn .count {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* More filters toggle */
.more-filters-btn {
    padding: 10px 16px;
    border: 2px dashed var(--border-color);
    background: transparent;
    border-radius: 100px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.more-filters-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
    margin-right: auto;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    padding-right: 48px;
    border: 2px solid var(--border-color);
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: white;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box .search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

/* Extra filters container */
.extra-filters {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 1px dashed var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-top: -25px;
    margin-bottom: 24px;
    padding: 14px 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   Section Header with Count
   ======================================== */
.orders-section {
    margin-top: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .icon {
    font-size: 22px;
}

.section-count {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   Orders Grid - Better Responsive
   ======================================== */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ========================================
   Order Card - Professional & Clean
   ======================================== */
.order-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(99, 102, 241, 0.2);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Order Header with Larger Status */
.order-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-primary) 0%, white 100%);
}

.order-id-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-id {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.order-time {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 400;
}

/* Larger Status Badge with Icon */
.status-badge {
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: var(--shadow-sm);
}

.status-badge .status-icon {
    font-size: 15px;
}

.status-badge.pending {
    background: var(--pending-light);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.status-badge.confirmed {
    background: var(--info-light);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge.on_the_way {
    background: var(--warning-light);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.delivered {
    background: var(--success-light);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Order Body - More Padding, Better Hierarchy */
.order-body {
    padding: 24px;
}

/* Customer Info - Clear Hierarchy */
.customer-info {
    margin-bottom: 20px;
}

.customer-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.customer-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-primary);
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.customer-detail {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.customer-detail:hover {
    color: var(--text-primary);
}

.customer-detail .icon {
    width: 34px;
    height: 34px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.customer-detail.phone-link {
    cursor: pointer;
}

.customer-detail.phone-link:hover {
    color: var(--success-color);
}

.customer-detail.phone-link:hover .icon {
    background: var(--success-light);
}

/* Order Items - Clean Table Style */
.order-items {
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    padding: 16px 18px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.order-items-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition-fast);
}

.item-row:hover {
    background: rgba(99, 102, 241, 0.04);
    margin: 0 -8px;
    padding: 10px 8px;
    border-radius: 6px;
}

.item-row:last-child {
    border-bottom: none;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.item-quantity {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Order Notes - Smaller */
.order-notes {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-notes .icon {
    font-size: 14px;
    flex-shrink: 0;
}

.order-notes p {
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
    line-height: 1.5;
}

/* Order Total - More Prominent */
.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0e7ff 100%);
    border-radius: var(--border-radius-sm);
    margin-top: 20px;
}

.total-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.total-amount {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

/* ========================================
   Action Buttons - Consistent 3 Buttons
   ======================================== */
.order-actions {
    padding: 18px 24px;
    background: var(--bg-primary);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    padding: 14px 12px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn .btn-icon {
    font-size: 16px;
}

/* Confirm - Green */
.action-btn.confirm {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.action-btn.confirm:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

/* On Way - Orange */
.action-btn.on-way {
    background: var(--warning-color);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.action-btn.on-way:hover:not(:disabled) {
    background: var(--warning-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

/* Delivered - Blue */
.action-btn.delivered {
    background: var(--info-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.action-btn.delivered:hover:not(:disabled) {
    background: var(--info-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

/* Disabled state */
.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: #cbd5e1 !important;
}

/* Completed state */
.order-completed {
    text-align: center;
    color: var(--success-color);
    font-weight: 600;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    grid-column: 1 / -1;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
    grid-column: 1 / -1;
}

.empty-state .icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    min-width: 320px;
    font-weight: 500;
}

.toast.success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 36px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-icon {
    font-size: 52px;
    margin-bottom: 16px;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 14px 36px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.modal-btn.secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.modal-btn.secondary:hover {
    background: var(--bg-hover);
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1200px) {
    .orders-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }

    .header {
        padding: 24px;
        border-radius: var(--border-radius);
    }

    .header h1 {
        font-size: 24px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-date {
        align-self: flex-start;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-info h3 {
        font-size: 26px;
    }

    .orders-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .filters-section {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filters-main {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-btn {
        flex: 1;
        justify-content: center;
        min-width: calc(50% - 6px);
    }

    .search-box {
        min-width: 100%;
        margin-right: 0;
    }

    .order-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-btn {
        padding: 16px;
    }

    .order-body {
        padding: 20px;
    }

    .customer-name {
        font-size: 17px;
    }

    .total-amount {
        font-size: 24px;
    }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .header,
    .filters-section,
    .order-actions,
    .toast-container {
        display: none;
    }

    .orders-grid {
        display: block;
    }

    .order-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
        margin-bottom: 20px;
    }
}
