/* ═══════════════════════════════════════════════════════════════
   نظام الكاشير - ملك الطابون
   Cashier System Styles
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   المتغيرات الأساسية - CSS Variables
   ═══════════════════════════════════════════════════════════════ */
:root {
    --primary: #FF5722;
    --dark: #1a1a1a;
    --light: #f4f4f4;
    --white: #fff;
    --gray: #666;
    --border: #ddd;
    --accent: #FF5722;
}

/* ═══════════════════════════════════════════════════════════════
   Reset وأنماط عامة - Reset & General Styles
   ═══════════════════════════════════════════════════════════════ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--light);
    height: 100vh;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   أنماط تسجيل الدخول - Login Styles
   ═══════════════════════════════════════════════════════════════ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--dark);
}

.login-container {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h1 {
    color: var(--primary);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--gray);
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.login-header .logo-icon i {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.cashier-subtitle {
    color: var(--accent);
    font-size: 0.95rem;
    margin-top: 5px;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   أنماط النماذج - Form Styles
   ═══════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 20px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    font-weight: 500;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-msg {
    color: #dc3545;
    margin-top: 10px;
    font-size: 0.9rem;
    padding: 10px;
    background: #fee2e2;
    border-radius: 5px;
}

.hidden {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   أنماط الكاشير الرئيسية - Main Cashier Styles
   ═══════════════════════════════════════════════════════════════ */
.cashier-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--light);
}

.cashier-header {
    background: var(--dark);
    color: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.cashier-header .logo {
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cashier-header .logo i {
    color: var(--accent);
    font-size: 1.5rem;
}

.cashier-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cashier-header .user-info span {
    font-size: 0.95rem;
    font-weight: 500;
}

.cashier-header .user-info button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cashier-header .user-info button:hover {
    background: rgba(255,255,255,0.2);
}

.cashier-main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.page-title {
    font-size: 1.5rem;
    color: var(--dark);
}

/* ═══════════════════════════════════════════════════════════════
   أنماط الطلبات - Orders Styles
   ═══════════════════════════════════════════════════════════════ */

/* Orders Header */
.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.orders-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Filter Buttons */
.order-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Sound Toggle */
.sound-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #22c55e;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.sound-toggle-btn:hover {
    transform: scale(1.1);
}

.sound-toggle-btn.muted {
    background: #ef4444;
}

/* Orders Stats */
.orders-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.order-stat {
    background: var(--white);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-right: 4px solid var(--gray);
    transition: all 0.3s ease;
}

.order-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.order-stat.new {
    border-color: #3b82f6;
}

.order-stat.preparing {
    border-color: #f97316;
}

.order-stat.ready {
    border-color: #22c55e;
}

.order-stat.revenue {
    border-color: #d4a853;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark);
}

/* Stat Highlight Animation */
@keyframes statPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.order-stat.highlight {
    animation: statPulse 0.5s ease;
}

/* Orders Grid */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   بطاقات الطلبات - Order Cards
   ═══════════════════════════════════════════════════════════════ */

.order-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-right: 5px solid var(--gray);
    transition: all 0.3s ease;
}

.order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.order-card.new {
    border-color: #3b82f6;
}

.order-card.preparing {
    border-color: #f97316;
}

.order-card.ready {
    border-color: #22c55e;
}

.order-card.delivered {
    border-color: #7c3aed;
    opacity: 0.8;
}

.order-card.cancelled {
    border-color: #ef4444;
    opacity: 0.6;
}

/* New Order Animation */
@keyframes newOrderPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    }
}

.order-card.new-arrival {
    animation: newOrderPulse 1s ease 3;
}

/* Card Header */
.card-header {
    padding: 12px 15px;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-id {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.new {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.preparing {
    background: #ffedd5;
    color: #c2410c;
}

.status-badge.ready {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.delivered {
    background: #f3e8ff;
    color: #7c3aed;
}

.status-badge.cancelled {
    background: #fee2e2;
    color: #dc2626;
}

/* Card Body */
.card-body {
    padding: 15px;
}

.customer-info {
    margin-bottom: 10px;
}

.customer-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.customer-phone {
    color: #22c55e;
    font-weight: 500;
}

.customer-phone i {
    margin-left: 5px;
}

.order-type {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.order-type i {
    margin-left: 5px;
}

.order-address,
.order-car {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 5px;
}

.order-address i,
.order-car i {
    margin-left: 5px;
}

/* حالة التوصيل */
.order-driver-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 8px;
    margin: 8px 0;
    font-size: 0.85rem;
    border: 1px solid #bae6fd;
}

.order-driver-status i {
    color: #0284c7;
}

.driver-name {
    font-weight: 600;
    color: #0369a1;
}

.delivery-status-badge {
    margin-right: auto;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.delivery-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.delivery-status-badge.driver_accepted {
    background: #dbeafe;
    color: #1d4ed8;
}

.delivery-status-badge.picked_up {
    background: #d1fae5;
    color: #065f46;
}

.delivery-status-badge.delivered {
    background: #a7f3d0;
    color: #047857;
}

.order-items {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   الملاحظات - Notes (Text & Voice)
   ═══════════════════════════════════════════════════════════════ */

.order-notes {
    padding: 10px;
    background: #fff3cd;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #856404;
    border-right: 3px solid #ffc107;
}

.order-notes strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* مشغل الملاحظة الصوتية */
.voice-note-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.voice-note-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #b45309 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-note-icon i {
    font-size: 1.1rem;
}

.voice-note-player audio {
    flex: 1;
    height: 36px;
    max-width: 300px;
}

.voice-note-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.voice-note-duration {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.voice-note-size {
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
    font-weight: 500;
}

/* ملاحظات نصية */
.text-notes {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    align-items: flex-start;
}

.text-notes i {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.text-notes span {
    color: #111827;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Card Footer */
.card-footer {
    padding: 12px 15px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.order-total {
    font-size: 1.2rem;
    font-weight: bold;
    color: #22c55e;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   الأزرار - Action Buttons
   ═══════════════════════════════════════════════════════════════ */

.btn-action {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-action i {
    margin-left: 5px;
}

.btn-next {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #22c55e;
}

.btn-next:hover {
    background: #22c55e;
    color: white;
}

.btn-cancel {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

.btn-cancel:hover {
    background: #ef4444;
    color: white;
}

.btn-print {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #6366f1;
    padding: 8px 10px;
}

.btn-print:hover {
    background: #6366f1;
    color: white;
}

.btn-kitchen {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #f59e0b;
    padding: 8px 10px;
}

.btn-kitchen:hover {
    background: #f59e0b;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════
   إشعارات Toast - Toast Notifications
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toast.warning {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.hide {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════
   حالات فارغة وتحميل - Empty States & Loading
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
    display: block;
}

.empty-state h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    grid-column: 1 / -1;
}

.loading-spinner i {
    margin-left: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive Design - التصميم المتجاوب
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .orders-grid {
        grid-template-columns: 1fr;
    }

    .orders-header {
        flex-direction: column;
        align-items: stretch;
    }

    .orders-controls {
        justify-content: space-between;
    }

    .order-filters {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .orders-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .cashier-main {
        padding: 15px;
    }

    .cashier-header {
        padding: 12px 15px;
    }

    .cashier-header .logo {
        font-size: 1rem;
    }

    .cashier-header .logo i {
        font-size: 1.2rem;
    }

    .cashier-header .user-info {
        gap: 10px;
    }

    .cashier-header .user-info span {
        display: none;
    }

    .cashier-header .user-info button {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .cashier-header .logo span {
        font-size: 0.85rem;
    }

    .orders-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .orders-controls {
        flex-direction: column;
        gap: 10px;
    }

    .order-filters {
        width: 100%;
        justify-content: space-between;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .voice-note-player {
        flex-wrap: wrap;
    }

    .voice-note-player audio {
        width: 100%;
        max-width: 100%;
    }

    .voice-note-size {
        width: 100%;
        text-align: center;
    }
}
