@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* تصميم عصري وجميل لمركز الطباعة */

/* إعدادات عامة */
* {
    direction: rtl;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* تحسينات للصفحة الرئيسية */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 3rem;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #edf2f7;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e9d8fd;
}

/* خلفية متحركة لمربع رفع الملف (تأثير طباعة) */
.print-upload-animated {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.print-upload-animated::before {
    content: '';
    position: absolute;
    inset: -30% -10%;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(79, 70, 229, 0.06) 0px,
            rgba(79, 70, 229, 0.06) 2px,
            transparent 2px,
            transparent 16px
        );
    animation: printLinesMove 8s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.print-upload-animated::after {
    content: '';
    position: absolute;
    width: 170px;
    height: 120px;
    left: -40px;
    top: 50%;
    transform: translateY(-50%) rotate(-10deg);
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(59, 130, 246, 0.15)) border-box;
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(30, 41, 59, 0.08);
    opacity: 0.8;
    animation: printPaperSlide 4.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes printLinesMove {
    from { transform: translateY(0); }
    to { transform: translateY(32px); }
}

@keyframes printPaperSlide {
    0%, 100% {
        left: -40px;
        opacity: 0.35;
    }
    50% {
        left: calc(100% - 130px);
        opacity: 0.85;
    }
}

/* خلفية مطبعة خفيفة لصفحات الواجهة */
.site-print-bg,
.index-print-bg {
    position: relative;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.82), rgba(238, 242, 255, 0.68)),
        url('img/ai_print_shop_background.png') center center / cover no-repeat,
        linear-gradient(135deg, #eff6ff 0%, #eef2ff 46%, #f8fafc 100%) !important;
    background-attachment: fixed;
}

.site-print-bg::before,
.index-print-bg::before {
    content: none;
}

.site-print-bg::after,
.index-print-bg::after {
    content: none;
}

.home-upload-card {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(4px);
    box-shadow: 0 14px 34px rgba(79, 70, 229, 0.12);
}

/* تحسينات لصفحة الطلب */
.option-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.option-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.option-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}

.option-card.selected::before {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #667eea;
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* إخفاء radios الأصلية */
input[type="radio"] {
    display: none;
}

/* تصميم الخيارات */
.paper-size-option,
.print-color-option,
.print-sides-option,
.binding-option {
    display: block;
}

.paper-size-option input,
.print-color-option input,
.print-sides-option input,
.binding-option input {
    display: inline-block;
    width: auto;
    height: auto;
    margin: 0;
}

.paper-size-option input:checked + div,
.print-color-option input:checked + div,
.print-sides-option input:checked + div,
.binding-option input:checked + div {
    border-color: #667eea !important;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* تصميم checkboxes */
input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.75rem;
    accent-color: #667eea;
}

/* تصميم ملخص التكلفة */
.cost-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.total-cost {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

/* تحسينات عرض الملف */
.file-preview {
    background: #f8f9fa;
    border-radius: 1rem;
    padding: 2rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e9ecef;
}

.file-preview img {
    max-width: 100%;
    max-height: 750px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.file-preview img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.file-icon {
    width: 120px;
    height: 750px;
    margin: 0 auto 1rem;
    opacity: 0.7;
}

/* تصميم الأزرار */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* تصميم النافذة المنبثقة للتأكيد */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

/* تصميم مؤشرات الخيارات على المعاينة */
.preview-indicators {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.indicators {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.indicator {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* تحسينات المعاينة */
#imagePreview,
#pdfPreview,
#pdfPreview {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    min-height: 750px;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

#imagePreview img,
#pdfFrame,
#pdfFrame {
    transition: all 0.3s ease;
    max-width: 100%;
    max-height: none;
    width: 100%;
    height: 750px;
    border: none;
    margin: 0;
    padding: 0;
    object-fit: contain;
    min-height: 750px;
}

#imagePreview img:hover,
#pdfFrame:hover,
#docContent:hover {
    transform: scale(1.02) !important;
}

/* تحسينات للمعاينة الكبيرة */
.preview-large {
    min-height: 750px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-large img {
    max-height: 750px !important;
    width: auto;
}

.preview-large iframe {
    height: 750px !important;
    width: 100%;
    min-width: 100%;
    border: none;
    max-height: none;
    object-fit: contain;
}

.preview-large #docContent {
    max-height: 750px;
    overflow-y: auto;
}

/* تحسينات لمعاينة المستندات */
.doc-preview-lines {
    animation: slideIn 0.5s ease;
}

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

/* تأثيرات التحويل للصور */
.image-grayscale {
    filter: grayscale(100%);
}

.image-scale-a3 {
    transform: scale(0.8);
}

.image-scale-a4 {
    transform: scale(1);
}

.image-scale-a5 {
    transform: scale(1.2);
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .hero-section {
        padding: 2rem 0;
    }
    
    .upload-area {
        padding: 2rem;
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .lg\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
}

/* تحسينات للوحة المفاتيح والتركيز */
.btn:focus,
input:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* تحسينات للطباعة */
@media print {
    .btn,
    .modal {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
}

/* رسوم متحركة للتحميل */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

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

/* تصميم خاص للأسعار */
.price-display {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

.price-over150 {
    display: block;
    font-size: 0.75rem;
    color: #e53e3e;
    margin-top: 0.25rem;
}

/* تصميم لمعاينة الملفات */
.file-info-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #e1bee7;
    border-radius: 0.75rem;
    padding: 1rem;
}

.file-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* تصميم للنماذج */
.form-section {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.form-section h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* تصميم للتحذيرات والرسائل */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border-right: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* تحسينات للجداول (إذا احتجناها لاحقاً) */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

/* تصميم للشارات والتسميات */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.badge-primary {
    background: #667eea;
    color: white;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

/* تصميم للخطوط التقدمية */
.progress {
    height: 0.5rem;
    background: #e9ecef;
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* إخفاء أسهم number */
.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.no-spin {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* تصميم معاينة التطبيق */
.preview-copy {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.preview-file-container {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.preview-file-container img.grayscale {
    filter: grayscale(100%);
}

.preview-file-container iframe {
    border: none;
    border-radius: 0.5rem;
}

/* مؤشرات الخيارات على المعاينة */
.preview-copy .absolute {
    z-index: 10;
    animation: fadeInScale 0.3s ease;
}

/* تصميم ملخص التطبيق */
#appliedSummary {
    background: linear-gradient(135deg, #d4f4dd 0%, #e8f5e8 100%);
    border: 1px solid #c3e6cb;
}

#appliedSummary h3 {
    color: #155724;
    border-bottom: 2px solid #c3e6cb;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

#appliedOptions .flex {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#appliedOptions .flex:last-child {
    border-bottom: none;
}

#appliedOptions .font-bold {
    color: #155724;
}

/* تصميم قسم معاينة التطبيق */
#appliedPreview {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4dd 100%);
    border: 2px dashed #c3e6cb;
    position: relative;
    overflow: hidden;
}

#appliedPreview::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* تحسينات للخيارات الإضافية */
#appliedExtras {
    background: rgba(76, 175, 80, 0.05);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

#appliedExtras .border-t {
    border-color: rgba(76, 175, 80, 0.2);
}

/* تصميم مؤشر التغليف */
.mt-3.p-2.text-white.text-center.rounded {
    animation: slideInUp 0.5s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

/* تحسينات متجاوبة للمعاينة */
@media (max-width: 768px) {
    .preview-copy {
        padding: 0.5rem;
    }
    
    .preview-file-container {
        height: 200px !important;
    }
    
    #appliedPreview {
        min-height: 200px;
    }
}

/* صفحة خيارات الطباعة — معاينة الملف على الجوال */
@media (max-width: 1023px) {
    .order-preview-section #imagePreview,
    .order-preview-section #pdfPreview,
    .order-preview-section #docPreview {
        min-height: 0;
        height: auto;
        width: 100%;
    }

    .order-preview-section #imagePreview img,
    .order-preview-section .order-preview-image {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: min(52vh, 460px);
        object-fit: contain;
    }

    .order-preview-section .order-pdf-preview-wrap {
        width: 100%;
        min-height: 0;
    }

    .order-preview-section #pdfFrame,
    .order-preview-section .order-pdf-frame {
        width: 100%;
        height: min(48vh, 400px);
        min-height: min(36vh, 280px);
        max-height: 52vh;
        border: none;
        display: block;
    }

    .order-preview-section .order-doc-content {
        max-height: min(40vh, 300px);
    }

    .order-preview-section #fileInfo {
        margin-top: 0.75rem;
        padding: 0.75rem 1rem;
    }
}

@media (min-width: 1024px) {
    .order-preview-section #imagePreview img,
    .order-preview-section .order-preview-image {
        max-height: 750px;
    }

    .order-preview-section #pdfFrame,
    .order-preview-section .order-pdf-frame {
        height: 750px;
        min-height: 750px;
    }
}
