/* =========================================
   1. التأسيس والخطوط (General Setup)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #020617 100%);
    background-attachment: fixed;
    color: white;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    direction: rtl;
}

/* =========================================
   2. تحسين السكرول بار (Custom Scrollbar)
   ========================================= */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 10px;
    border: 2px solid #0f172a;
}
::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

/* =========================================
   3. تأثير الزجاج والمؤثرات البصرية (Glassmorphism)
   ========================================= */
.glass {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.device-active {
    background: rgba(239, 68, 68, 0.05) !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.15);
    transform: translateY(-5px);
}

/* =========================================
   4. الحركات والأنيميشن (Animations)
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.animate-slide-up {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================
   5. تنسيق الفاتورة الورقية (Receipt Style)
   ========================================= */
.vertical-receipt {
    background: #fff;
    color: #000;
    padding: 40px 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    border-radius: 4px; /* حواف حادة قليلاً لتبدو كالورقة */
}

/* تأثير مشرشر من الأعلى والأسفل للفاتورة */
.vertical-receipt::before, .vertical-receipt::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 10px;
    background-size: 20px 20px;
    background-repeat: repeat-x;
}

.vertical-receipt::before {
    top: -10px;
    background-image: linear-gradient(45deg, transparent 33.333%, #ffffff 33.333%, #ffffff 66.666%, transparent 66.666%), 
                      linear-gradient(-45deg, transparent 33.333%, #ffffff 33.333%, #ffffff 66.666%, transparent 66.666%);
}

.vertical-receipt::after {
    bottom: -10px;
    background-image: linear-gradient(45deg, #ffffff 33.333%, transparent 33.333%, transparent 66.666%, #ffffff 66.666%), 
                      linear-gradient(-45deg, #ffffff 33.333%, transparent 33.333%, transparent 66.666%, #ffffff 66.666%);
}

/* =========================================
   6. زر الواتساب العائم (Floating UI)
   ========================================= */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1) rotate(10deg);
    background-color: #20ba5a;
}

.whatsapp-svg {
    width: 32px;
    height: 32px;
}

/* =========================================
   7. مدخلات البيانات (Form Elements)
   ========================================= */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:focus {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

/* =========================================
   8. تحسينات العرض على الموبايل (Responsive Design)
   ========================================= */
@media (max-width: 768px) {
    header {
        text-align: center;
        border-radius: 0 0 2rem 2rem;
        margin-top: -1rem;
        margin-left: -1rem;
        margin-right: -1rem;
    }

    #total-revenue-container {
        width: 100%;
        margin-top: 10px;
    }

    .grid {
        grid-template-cols: 1fr;
    }

    /* تكبير الأزرار للمس في الموبايل */
    button {
        min-height: 48px;
    }
}

/* =========================================
   9. إضافات جمالية (Extras)
   ========================================= */
canvas {
    max-width: 100% !important;
}

.modal-open {
    overflow: hidden;
}

/* تأثير التدرج في النصوص */
.text-gradient {
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}