/* الخطوط المحلية - تحميل من مجلد /fonts */
@font-face {
    font-family: 'ahmedoweb';
    src: url('fonts/ahmedoweb-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ahmedoweb';
    src: url('fonts/ahmedoweb-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ahmedoweb';
    src: url('fonts/ahmedoweb-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* نظام التصميم (Variables) - سهل التخصيص */
:root{
    /* الألوان */
    --color-primary: #1e3a8a; /* brand dark */
    --color-primary-300: #3b82f6; /* brand light */
    --color-primary-600: #2563eb; /* hover */
    --color-accent: #10b981; /* success */
    --color-danger: #ef4444;
    --muted: #6b7280;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #2d3748;
    --muted-light: #cbd5e0;

    /* مقاسات */
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.08);

    /* typography */
    --base-font-size: 16px;
    --heading-weight: 700;

    /* breakpoints */
    --bp-sm: 640px;
    --bp-md: 900px;
}

/* الخطوط الأساسية */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'ahmedoweb';
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: var(--base-font-size);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* ترويسة جديدة مع الصورة */
.new-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-300));
    padding: 12px 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* App header / navigation (responsive) */
.app-header {
    width: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-300));
    color: #fff;
    padding: 10px 0;
    box-shadow: var(--shadow);
}
.app-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand img { height: 42px; width: auto; border-radius: 6px; }
.brand .title { font-weight: var(--heading-weight); font-size: 1rem; }
.app-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-nav .nav-link { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.app-nav .nav-link.secondary { background: rgba(255,255,255,0.08); }

/* Mobile: hamburger and bottom action bar */
.mobile-hamburger { display: none; background: transparent; border: none; color: #fff; font-size: 20px; }
.mobile-bottom-bar {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid #e6edf8;
    padding: 8px 12px;
    box-shadow: 0 -6px 16px rgba(0,0,0,0.06);
    z-index: 60;
}
.mobile-bottom-bar .btn { flex: 1; margin: 0 6px; }

@media (max-width: 640px) {
    .app-nav { display: none; }
    .mobile-hamburger { display: inline-block; }
    .container { padding-bottom: 72px; }
    .mobile-bottom-bar { display: flex; gap: 8px; }
}

/* Cards and table responsive improvements */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 2px 6px rgba(16,24,40,0.04);
}
.compact-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(2,6,23,0.04);
}
.compact-table thead { background: linear-gradient(90deg,var(--color-primary),var(--color-primary-300)); color: #fff; }
.compact-table th, .compact-table td { padding: 10px 8px; text-align: right; border-bottom: 1px solid #f1f5f9; }
.compact-table tr:hover { background: #fbfdff; }

/* Responsive table: stack rows on very small screens */
@media (max-width: 700px) {
    .compact-table thead { display: none; }
    .compact-table, .compact-table tbody, .compact-table tr, .compact-table td { display: block; width: 100%; }
    .compact-table tr { margin-bottom: 12px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(2,6,23,0.04); }
    .compact-table td { text-align: right; padding: 10px; border-bottom: none; position: relative; }
    .compact-table td::before { content: attr(data-label); display: inline-block; font-weight: 600; margin-left: 6px; color: var(--muted); }
}

/* نماذج وأزرار محسّنة للمس */
.bolisa-form input[type="text"], .bolisa-form input[type="date"], .bolisa-form input[type="number"],
.bolisa-form select, .bolisa-form textarea, input[type="text"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e6eefc;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: var(--text);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.bolisa-form input:focus, .bolisa-form textarea:focus, .bolisa-form select:focus,
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary-300);
    box-shadow: 0 6px 18px rgba(59,130,246,0.08);
}

.form-section { background: linear-gradient(180deg,#ffffff,#fbfdff); border-radius: var(--radius); }

/* Modal and toast styles */
.app-modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.app-modal { background: #fff; border-radius: 10px; padding: 14px; width: 92%; max-width: 420px; box-shadow: 0 10px 30px rgba(2,6,23,0.12); }
.app-modal h3 { margin-bottom: 8px; font-size: 1.05rem; }
.app-modal .modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; }
.app-modal .btn { padding: 8px 12px; border-radius: 8px; }
.app-modal-backdrop.show { display:flex; }

.app-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; background: rgba(17,24,39,0.96); color: #fff; padding: 8px 14px; border-radius: 8px; opacity: 0; transition: opacity .18s ease, transform .18s ease; z-index: 120; }
.app-toast.visible { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* Hide app chrome when printing */
@media print {
    .app-header, .mobile-bottom-bar, .no-print { display: none !important; }
    .container { padding: 6mm !important; }
    body { background: #fff !important; color: #000 !important; }
    .compact-table thead { display: table-header-group !important; }
}

/* === Screen-specific UI for print pages (non-print controls) === */
@media screen {
    .print-container {
        max-width: 1060px;
        margin: 18px auto;
        padding: 22px;
        background: var(--card-bg);
        border-radius: 12px;
        box-shadow: 0 12px 30px rgba(2,6,23,0.06);
    }

    .bolisa-print-new {
        padding: 16px;
        border-radius: 10px;
        background: linear-gradient(180deg,#fff,#fbfdff);
    }

    .no-print.actions {
        position: fixed;
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
        display: flex !important;
        gap: 10px;
        align-items: center;
        background: rgba(255,255,255,0.98);
        padding: 8px;
        border-radius: 999px;
        z-index: 220;
        box-shadow: 0 12px 30px rgba(2,6,23,0.12);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }

    .no-print.actions .btn {
        padding: 12px 18px;
        border-radius: 999px;
        font-size: 15px;
        box-shadow: 0 6px 18px rgba(2,6,23,0.08);
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    /* Desktop: move actions to top-right and make them compact */
    @media (min-width: 900px) {
        .no-print.actions {
            position: absolute;
            top: 18px;
            right: 18px;
            left: auto;
            transform: none;
            background: transparent;
            padding: 0;
            box-shadow: none;
        }

        .no-print.actions .btn {
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 13px;
            box-shadow: 0 2px 8px rgba(2,6,23,0.04);
        }

        .print-container { margin-top: 36px; }
    }

    .print-banner { border: 1px solid rgba(0,0,0,0.06); background: linear-gradient(90deg,var(--color-primary),var(--color-primary-300)); color: #fff; }
    .print-banner-text h1 { color: #fff; font-size: 1.15rem; }
    .print-banner-text p { color: rgba(255,255,255,0.92); }
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo-img {
    height: 50px;
    width: auto;
    border-radius: 4px;
}

.header-text {
    text-align: right;
}

.header-text h1 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 4px;
    font-weight: var(--heading-weight);
}

.header-text .subtitle {
    color: var(--muted-light);
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 500;
}

.header-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--muted-light);
    font-size: 0.75rem;
}

.header-contact div {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* الأزرار المحسنة */
.actions {
    margin-bottom: 0px;
    text-align: center;
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    margin: 4px;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: center;
    box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.btn-primary {
    background-color: var(--color-primary-300);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-600);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37,99,235,0.12);
}

.btn-secondary {
    background-color: var(--muted);
    color: white;
}

/* Specific action buttons */
.btn-view { background: linear-gradient(90deg,var(--color-accent),#059669); color: #fff; padding:6px 10px; border-radius:6px; }
.btn-edit { background: linear-gradient(90deg,#f59e0b,#f59e0b); color:#fff; padding:6px 10px; border-radius:6px; }
.btn-delete { background: linear-gradient(90deg,var(--color-danger),#dc2626); color:#fff; padding:6px 10px; border-radius:6px; }

.actions { display:flex; gap:8px; align-items:center; justify-content:flex-end; }

/* Form spacing */
.form-row { gap:12px; margin-bottom:12px; }
.form-group label { display:block; margin-bottom:6px; }

/* Card list */
.bolisas-list { padding:12px; }


.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-view {
    background-color: #10b981;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-edit {
    background-color: #f59e0b;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-delete {
    background-color: #ef4444;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

/* الجدول المحسن */
.bolisas-list {
    background: white;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bolisas-list h2 {
    margin-bottom: 15px;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    font-size: 1.1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 12px;
}

th, td {
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 11px;
}

tr:hover {
    background-color: #f8fafc;
}

/* النموذج المحسن */
.bolisa-form {
    background: white;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.form-section h2 {
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #3b82f6;
    font-size: 1rem;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group.full-width {
    flex: 100%;
}

label {
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
    color: #374151;
    font-size: 12px;
}

input, textarea, select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    transition: border-color 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.form-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

/* تنسيقات الأصناف المتعددة المحسنة */
.item-row {
    border: 1px solid #e2e8f0;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    background-color: #f8fafc;
}

.item-actions {
    display: flex;
    align-items: flex-end;
}

.item-actions .btn {
    margin-bottom: 0;
    font-size: 11px;
    padding: 4px 8px;
}

#totalQuantity {
    font-size: 12px;
    color: #059669;
    font-weight: normal;
    margin-right: 8px;
}

/* تنسيقات الطباعة المحسنة */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-container, .print-container * {
        visibility: visible;
    }
    
    .print-container {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        width: 100% !important;
        max-width: none !important;
        padding: 3mm !important;
        box-sizing: border-box;
    }
    
    .no-print {
        display: none !important;
    }

    .print-footer {
        overflow: visible !important;
    }

    .footer-signature {
        float: left !important;
        text-align: left !important;
        width: 40% !important;
        margin-left: 0 !important;
    }

    .footer-notes {
        float: right !important;
        text-align: right !important;
        width: 55% !important;
    }
}

.print-container {
    max-width: 210mm;
    margin: 0 auto;
    padding: 15mm;
    background: white;
    font-size: 11px;
}

.bolisa-print {
    border: 1px solid #333;
    padding: 10mm;
    min-height: 287mm;
    font-size: 11px;
}

/* تنسيقات البوليصة الجديدة - تصميم احترافي */
.bolisa-print-new {
    padding: 10mm;
    min-height: 287mm;
    font-size: 11px;
    background: white;
    border: 2px solid #1e3a8a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* البانر العلوي */
.print-banner {
    width: 100%;
    height: 100px;
    margin-bottom: 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #000;
    font-weight: bold;
    font-size: 18px;
    position: relative;
    overflow: hidden;
    background: transparent;
    border: 1px solid #d1d5db;
}

.print-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.print-banner-text {
    position: relative;
    z-index: 2;
    text-align: right;
}

.print-banner-text h1 {
    font-size: 20px;
    margin-bottom: 5px;
    color: #000;
    text-shadow: none;
    padding-left: 10px;
    padding-right: 10px;
}

.print-banner-text p {
    font-size: 12px;
    color: #204093;
    padding-left: 10px;
    padding-right: 10px;
}

.print-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
}

.print-logo img {
    width: 75px;
    height: 100%;
    object-fit: contain;
    display: block;
}

.header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 4px;
    border: 1px solid #cbd5e0;
}

.header-left {
    text-align: left;
}

.header-right {
    text-align: right;
}

.bolisa-number {
    color: #dc2626;
    font-weight: bold;
    font-size: 14px;
}

.notes-placeholder {
    color: #6b7280;
    font-style: italic;
}

.bolisa-date, .client-name {
    font-weight: bold;
    color: #1e3a8a;
}

.section-header {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6) !important;
    color: white !important;
    font-weight: bold;
    text-align: center;
}

.section-header th {
    background: #e2e8f0 !important;
    color: #000000 !important;
    border: 1px solid #1e3a8a;
    padding: 10px 6px;
}

.field-group {
    margin: 5px 0;
}

.field-group label {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    color: #374151;
}

.placeholder-box {
    padding: 8px;
    min-height: 20px;
    color: #1f2937;
    font-style: normal;
    border-radius: 4px;
    background: transparent;
    border: none;
}

.placeholder-box.large {
    min-height: 60px;
}

.footer-row {
    color: #08a070;
    font-size: 11px;
    font-weight: bold;
}

.footer-row td {
    border: 1px solid #047857;
    text-align: center;
    padding: 10px 6px;
}

.print-footer {
    margin-top: 20px;
    border-top: 2px solid #1e3a8a;
    padding-top: 15px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 6px;
    padding: 15px;
}

.footer-notes, .footer-signature {
    margin-bottom: 15px;
}

.footer-notes label, .footer-signature label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #1e3a8a;
}

.print-header-full {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1e3a8a;
}

.print-logo {
    height: 45px;
    width: auto;
}

.print-header-text {
    text-align: center;
    flex-grow: 1;
}

.print-header-text h1 {
    font-size: 16px;
    margin-bottom: 3px;
    color: #1e3a8a;
}

.print-header-text h2 {
    font-size: 12px;
    margin-bottom: 3px;
    color: #374151;
}

.print-contact {
    text-align: left;
    font-size: 9px;
    color: #666;
}

.print-section {
    margin-bottom: 15px;
    background: white;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.print-section h3 {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 8px 12px;
    margin: -12px -12px 12px -12px;
    border-radius: 6px 6px 0 0;
    border-right: 4px solid #3b82f6;
    font-size: 12px;
    color: #1e3a8a;
    font-weight: bold;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.print-table th, .print-table td {
    padding: 8px 6px;
    border: 1px solid #d1d5db;
    text-align: right;
}

.print-table th {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    font-weight: 600;
    font-size: 11px;
    color: #1e3a8a;
}

.print-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.print-table tr:hover {
    background-color: #f1f5f9;
}

.items-table {
    margin-top: 6px;
    font-size: 9px;
}

.items-table th,
.items-table td {
    text-align: center;
    padding: 6px 4px;
}

.items-table tfoot {
    font-weight: bold;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.notes {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: linear-gradient(135deg, #fef3c7, #fef7cd);
    min-height: 40px;
    font-size: 10px;
    border-left: 4px solid #f59e0b;
}

.system-user {
    margin-top: 12px;
    border-top: 2px solid #1e3a8a;
    padding-top: 8px;
    font-size: 9px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 10px;
    border-radius: 4px;
}

.signatures {
    margin-top: 20px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.signature-table {
    width: 100%;
    margin-top: 12px;
    font-size: 9px;
}

.signature-table td {
    text-align: center;
    vertical-align: top;
    border: none;
}

.signature-line {
    height: 2px;
    background: linear-gradient(90deg, #1e3a8a, #3b82f6);
    margin: 25px 0 5px 0;
    border-radius: 1px;
}

.signature-table p {
    font-size: 8px;
    color: #6b7280;
    font-weight: bold;
}

/* الوسائط المتعددة للطباعة المحسنة */
@media print {
    @page {
        size: A4;
        margin: 5mm;
    }
    
    body {
        margin: 0;
        padding: 0;
        font-size: 10px;
    }
    
    .bolisa-print, .bolisa-print-new {
        border: none;
        padding: 2mm;
        margin: 0;
        box-shadow: none;
        min-height: auto;
        font-size: 12px;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box;
    }
    
    .print-header-full {
        border-bottom: 2px solid #1e3a8a;
    }
    
    .print-table {
        display: table !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed;
        border-collapse: collapse;
        page-break-inside: auto;
        margin: 0 !important;
        float: none !important;
        box-sizing: border-box;
    }

    .print-table th, .print-table td {
        padding: 2px 3px;
        border: 1px solid #d1d5db;
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 11px;
        line-height: 1.2;
    }

    .print-table td[width], .print-table th[width] {
        width: auto !important;
        max-width: none !important;
    }

    .print-section {
        width: 100% !important;
        max-width: none !important;
        padding: 2mm !important;
        box-sizing: border-box;
    }

    .print-section .print-table.driver-info, .print-section .print-table {
        width: 100% !important;
        table-layout: fixed;
    }

    .print-section .print-table tr td, .print-section .print-table tr th {
        padding: 2px 4px;
        font-size: 10.5px;
        line-height: 1.18;
    }

    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr { page-break-inside: avoid; page-break-after: auto; }

    .print-table td[width], .print-table th[width] {
        width: auto !important;
    }
    
    .items-table th,
    .items-table td {
        padding: 4px 6px;
        font-size: 10px;
    }
    
    .header-row {
        margin-bottom: 8px;
    }
    
    .placeholder-box {
        padding: 6px;
        min-height: 18px;
    }
    
    .print-footer {
        margin-top: 15px;
        padding-top: 10px;
    }
    
    .print-banner {
        height: 40px;
        margin-bottom: 3px;
    }
    
    .print-banner-text h1 {
        font-size: 15px;
    }
}

/* Screen: make print view wide & dense on mobile (viewing in browser) */
@media (max-width: 768px) {
    .print-container {
        width: 100%;
        max-width: 100%;
        padding: 8px !important;
        margin: 0;
        box-shadow: none;
    }

    .bolisa-print-new {
        padding: 10px;
        border-width: 1px;
        border-radius: 6px;
        box-shadow: none;
        min-height: auto;
        font-size: 14px;
    }

    .print-banner {
        height: 56px;
        margin-bottom: 6px;
    }

    .print-section {
        margin-bottom: 8px;
        padding: 8px;
    }

    .print-table, .items-table {
        font-size: 13px;
    }

    .print-table th, .print-table td {
        padding: 6px 6px;
    }

    .items-table th, .items-table td {
        padding: 4px 4px;
    }

    .footer-notes, .footer-signature {
        margin-bottom: 8px;
    }
}

/* الفوتر المحسن */
.main-footer {
    margin-top: 25px;
    padding: 12px;
    background: linear-gradient(135deg, #1e293b, #374151);
    color: #cbd5e0;
    text-align: center;
    border-radius: 4px;
    font-size: 10px;
}

.footer-content p {
    margin: 2px 0;
    font-size: 10px;
    opacity: 0.8;
}

/* تحسين التجاوب */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .header-logo {
        flex-direction: column;
    }
    
    .header-text {
        text-align: center;
    }
    
    .header-contact {
        align-items: center;
    }
    
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 3px;
    }
    
    .btn {
        display: block;
        width: 100%;
        margin: 2px 0;
        font-size: 12px;
    }
    
    .actions .btn {
        display: inline-block;
        width: auto;
        margin: 2px;
    }
    
    .item-row {
        flex-direction: column;
        padding: 8px;
    }
    
    .item-actions {
        justify-content: center;
        margin-top: 6px;
    }
    
    .print-header-full {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .print-contact {
        text-align: center;
    }
}

/* Print: place placeholder-box next to label for driver info rows */
@media print {
    .print-section .field-group {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .print-section .field-group label {
        width: 30%;
        margin: 0;
        font-weight: 700;
        text-align: right;
        font-size: 9px;
    }

    .print-section .field-group .placeholder-box {
        width: 70%;
        padding: 4px 6px;
        min-height: 18px;
        background: transparent;
        border: none;
        text-align: right;
        font-size: 9px;
    }

    .print-section .field-group.small-label label {
        width: 40%;
    }
}

/* تحسينات إضافية للطباعة */
@media print {
    .print-container {
        padding: 5mm !important;
    }
    
    .bolisa-print, .bolisa-print-new {
        padding: 3mm;
    }
    
    .print-table {
        font-size: 9px;
    }
    
    .items-table {
        font-size: 8px;
    }
    
    .print-section h3 {
        font-size: 10px;
        padding: 6px 10px;
    }
    
    .print-section {
        margin-bottom: 8px;
    }
    
    .signature-line {
        margin: 15px 0 3px 0;
    }
    
    .items-table td {
        padding: 2px 2px;
    }
}

/* تحسينات للأصناف المتعددة في الواجهة */
#itemsContainer .item-row {
    margin-bottom: 5px;
}

.item-description, .item-quantity, .item-package {
    font-size: 11px;
    padding: 4px 6px;
}

/* تحسين الشكل العام للجداول */
table.compact-table {
    font-size: 11px;
}

table.compact-table th,
table.compact-table td {
    padding: 4px 6px;
}

/* تنسيقات إضافية للطباعة لتوفير المساحة */
@media print {
    .print-table.compact-print {
        font-size: 8px;
    }
    
    .print-table.compact-print th,
    .print-table.compact-print td {
        padding: 2px 3px;
    }
    
    .signatures {
        margin-top: 10px;
    }
}

.item-package {
    font-size: 11px;
    padding: 4px 6px;
}

#itemsContainer .item-row {
    margin-bottom: 5px;
}

.item-description, .item-package, .item-quantity {
    font-size: 11px;
    padding: 4px 6px;
}

/* تحسين التجاوب للشاشات الصغيرة */
@media (max-width: 768px) {
    .item-row {
        flex-direction: column;
        padding: 8px;
    }
    
    .item-actions {
        justify-content: center;
        margin-top: 6px;
    }
}

/* ألوان وتدرجات إضافية */
.gradient-primary {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
}

.gradient-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.gradient-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

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

/* ظلال وتحسينات بصرية */
.shadow-sm {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shadow-md {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

/* حدود محسنة */
.border-primary {
    border-color: #3b82f6;
}

.border-success {
    border-color: #10b981;
}

.border-warning {
    border-color: #f59e0b;
}

.border-danger {
    border-color: #ef4444;
}

/* ==========================
   تحسينات تجربة المستخدم للجوال
   ========================== */
@media (max-width: 768px) {
    html, body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    body {
        line-height: 1.6;
        font-size: 16px;
    }

    .container {
        padding: 3px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 15px;
        border-radius: 8px;
        min-height: 44px;
        display: inline-block;
    }

    .actions .btn, .btn-primary, .btn-secondary, .btn-view, .btn-edit, .btn-delete, .btn-danger {
        width: 100%;
        display: block;
        box-sizing: border-box;
    }

    .header-content {
        padding: 12px;
        gap: 12px;
    }

    .header-text h1 {
        font-size: 1.2rem;
    }

    .header-text .subtitle {
        font-size: 0.95rem;
    }

    table, .print-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 14px;
    }

    th, td, .print-table th, .print-table td {
        padding: 10px 8px;
        text-align: right;
    }

    input, textarea, select {
        padding: 10px 12px;
        font-size: 15px;
    }

    label {
        font-size: 13px;
    }

    .form-row { gap: 10px; }

    .form-group { min-width: 100%; }

    .item-row {
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 6px;
    }

    .item-actions {
        gap: 8px;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .item-actions .btn {
        font-size: 14px;
        padding: 10px 12px;
    }

    .print-container { padding: 3mm !important; }

    .bolisas-list, .bolisa-form, .print-section {
        padding: 16px;
    }

    .bolisas-list, .print-container {
        max-width: 100%;
    }

    .form-row, .header-content, .print-header-full {
        flex-direction: column;
        align-items: stretch;
    }

    .item-description, .item-package, .item-quantity {
        font-size: 14px;
    }

    .btn + .btn { margin-top: 8px; }
}

/* تحويل جداول compact-table إلى بطاقات مكدسة على الأجهزة الصغيرة */
@media (max-width: 768px) {
    table.compact-table {
        border: none;
    }

    table.compact-table thead {
        display: none;
    }

    table.compact-table tbody {
        display: block;
    }

    table.compact-table tbody tr {
        display: block;
        background: #ffffff;
        margin-bottom: 12px;
        padding: 12px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        border: 1px solid rgba(17,24,39,0.04);
    }

    table.compact-table tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 6px;
        border: none;
        white-space: normal;
        font-size: 15px;
    }

    table.compact-table tbody tr td::before {
        content: attr(data-label) " ";
        font-weight: 600;
        color: #374151;
        margin-left: 8px;
        display: inline-block;
        text-align: right;
        min-width: 110px;
    }

    table.compact-table tbody tr td.actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    table.compact-table tbody tr td.actions::before { display: none; }

    table.compact-table tbody tr td.actions .btn {
        width: 100%;
        display: block;
        padding: 10px 12px;
        font-size: 14px;
    }
}