/* sales.css - موديول المبيعات | ERP ECHO
   - استخدم هذا الملف لكل صفحات المبيعات
   - اجعل كل صفحة داخل كارد واحد رئيسي (.sales-card)
   - يشمل أنماط للـ form, table, buttons, summary, responsive
   - RTL-aware
*/
* {
   font-family:Cairo,sans-serif;
}
:root {
    --sales-bg: #ffffff;
    --sales-panel-bg: #f8fafc;
    /* light panel */
    --accent: #0b74de;
    /* main blue */
    --muted: #6b7280;
    /* gray */
    --success: #16a34a;
    --danger: #ef4444;
    --radius: 12px;
    --card-pad: 18px;
    --input-h: 44px;
}


/* ===== Container / Card ===== */

.sales-card {
    max-width: 1000px;
    margin: 20px auto;
    background: var(--sales-bg);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 6px 18px rgba(13, 24, 43, 0.06);
    padding: 18px;
    overflow: hidden;
    direction: rtl;
    /* ensure RTL inside sales pages */
}

.sales-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.sales-card .card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.sales-card .card-sub {
    color: var(--muted);
    font-size: 13px
}


/* ===== Panels inside the sales card ===== */

.sales-panel {
    background: var(--sales-panel-bg);
    border: 1px solid rgba(14, 30, 55, 0.04);
    padding: var(--card-pad);
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 14px;
}


/* Form layout */

.sales-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sales-row .col {
    flex: 1;
}

.sales-panel label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #1f2937
}

.sales-panel input[type="text"],
.sales-panel input[type="number"],
.sales-panel select,
.sales-panel textarea {
    height: var(--input-h);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e6eef8;
    background: #fff;
    box-sizing: border-box;
    font-size: 14px;
}

.sales-panel input[readonly] {
    background: #f3f4f6
}


/* Buttons */

.sales-btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all .12s ease;
}

.sales-btn.primary {
    background: var(--accent);
    color: #fff
}

.sales-btn.secondary {
    background: transparent;
    border: 1px solid rgba(11, 116, 222, 0.12);
    color: var(--accent)
}

.sales-btn.ghost {
    background: #fff;
    border: 1px solid #e6eef8;
    color: var(--muted)
}

.sales-btn.danger {
    background: var(--danger);
    color: #fff
}

.sales-btn:active {
    transform: translateY(1px)
}


/* Table styles */

.sales-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.sales-table thead th {
    background: #f1f5f9;
    color: #111827;
    font-weight: 700;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(14, 30, 55, 0.04);
}

.sales-table tbody td {
    padding: 10px;
    border-bottom: 1px solid rgba(14, 30, 55, 0.03);
    text-align: center;
    font-size: 14px
}

.sales-table tbody tr:last-child td {
    border-bottom: 0
}

.sales-table input[type=number] {
    width: 80px;
    height: 36px;
    border-radius: 8px;
    padding: 4px
}


/* Small helpers */

.text-right {
    text-align: right
}

.text-left {
    text-align: left
}

.small {
    font-size: 13px;
    color: var(--muted)
}

.kicker {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px
}


/* Summary box */

.sales-summary {
    display: flex;
    gap: 18px;
    align-items: flex-end;
    justify-content: flex-end
}

.sales-summary .summary-card {
    background: var(--sales-bg);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(14, 30, 55, 0.04);
    min-width: 220px
}

.sales-summary .summary-card .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px
}

.sales-summary .grand {
    font-size: 18px;
    font-weight: 800;
    color: #111827
}


/* Responsive */

@media (max-width: 900px) {
    .sales-card:not(.sales-list) .sales-row {
        display: block;
    }

    .sales-card:not(.sales-list) .sales-row .col {
        width: 100%;
        margin-bottom: 10px;
    }
}



/* Focus / accessibility */

.sales-panel input:focus,
.sales-panel select:focus,
.sales-panel textarea:focus {
    outline: 3px solid rgba(11, 116, 222, 0.12);
    box-shadow: 0 6px 18px rgba(11, 116, 222, 0.06)
}


/* Utility for center aligning card when used inside dashboard column */

.sales-center-wrap {
    display: flex;
    justify-content: center
}


/* Tiny animations */

.fade-in {
    animation: fadeIn .18s ease both
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px)
    }
    to {
        opacity: 1;
        transform: none
    }
}

.invoice-success-box {
    background: linear-gradient(135deg, #0b74de 0%, #0b95d7 100%);
    color: #fff;
    text-align: center;
    padding: 25px 15px;
    margin: 25px auto;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(11, 116, 222, 0.25);
    width: 90%;
    max-width: 400px;
    animation: fadeIn 0.4s ease-in-out;
}

.invoice-success-box p {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.btn-view-invoice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #0b74de;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
}

.btn-view-invoice:hover {
    background: #f2f7ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.btn-view-invoice i {
    font-style: normal;
    font-size: 18px;
    animation: pulse 1.2s infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}


/* End of sales.css */
/* ======================================================
   SALES AUTOCOMPLETE (Product Search Suggestion Box)
   ====================================================== */

.suggest-box {
    position: relative;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
}

.suggest-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.suggest-item:last-child {
    border-bottom: none;
}

.suggest-item:hover {
    background: #f8fafc;
}

.suggest-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.suggest-top strong {
    font-weight: 800;
    font-size: 14px;
    color: #0f172a;
}

.suggest-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

/* badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    white-space: nowrap;
}

.badge.ok {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}

.badge.no {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
/* ===== Page Background ===== */
.invoice-page{
  padding: 24px;
  background: #f4f6fb;
}

/* ===== Main White Form ===== */
.invoice-form{
  background: #fff;
  border-radius: 18px;
  padding: 28px 28px 32px;
  box-shadow: 0 10px 35px rgba(15,23,42,.06);
  max-width: 1400px;
  margin: auto;
}

/* ===== Header ===== */
.invoice-header{
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.invoice-header h1{
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.invoice-header p{
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
}

/* ===== Keep layout clean inside ===== */
.invoice-form .card{
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  box-shadow: none;
}

/* ===== Improve spacing ===== */
.sales-layout{
  gap: 24px;
}

/* ===== Buttons area ===== */
.sum-actions{
  margin-top: 18px;
}
/* ================= SaaS Invoice Page ================= */

.invoice-saas-page{
  padding: 32px;
  background: #f1f5f9;
}

/* ===== Main Container ===== */
.invoice-saas-form{
  max-width: 1440px;
  margin: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 28px 36px;
  box-shadow:
    0 10px 25px rgba(15,23,42,.06),
    0 2px 6px rgba(15,23,42,.04);
}

/* ===== Header ===== */
.invoice-saas-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-saas-header h1{
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.invoice-saas-header p{
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
}

/* ===== Layout spacing ===== */
.sales-layout{
  gap: 28px;
}

/* ===== Cards inside SaaS form ===== */
.invoice-saas-form .card{
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: none;
  padding: 18px;
}

/* ===== Card titles ===== */
.invoice-saas-form .card h4{
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #0f172a;
}

/* ===== Inputs ===== */
.invoice-saas-form input,
.invoice-saas-form select,
.invoice-saas-form textarea{
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  transition: .15s ease;
}

.invoice-saas-form input:focus,
.invoice-saas-form select:focus,
.invoice-saas-form textarea:focus{
  outline: none;
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ===== Summary Side ===== */
.summary-card{
  background: linear-gradient(180deg,#ffffff,#f9fafb);
  border: 1px solid #e5e7eb;
}

/* ===== Totals ===== */
.total-line{
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

#final_grand{
  font-size: 18px;
  font-weight: 800;
  color: #2563eb;
}

/* ===== Buttons ===== */
.btn.primary{
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(37,99,235,.35);
}

.btn.primary:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37,99,235,.45);
}

.btn.ghost{
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-weight: 600;
}

/* ===== Alerts ===== */
.alert.err{
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
}
/* ===== SaaS Header ===== */
.invoice-saas-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

/* Title */
.inv-title h1{
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.inv-title p{
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
}

/* Meta */
.inv-meta{
  display: flex;
  align-items: center;
  gap: 14px;
}

.meta-box{
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 110px;
  text-align: center;
}

.meta-box .label{
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
}

.meta-box strong{
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

/* Status */
.meta-box.status{
  padding: 10px 16px;
  font-weight: 700;
  border-radius: 999px;
  font-size: 12px;
}

.meta-box.status.draft{
  background: #fefce8;
  color: #92400e;
  border: 1px solid #fde68a;
}

.meta-box.status.confirmed{
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.filters-card{
  background:#fff;padding:14px;border-radius:16px;
  box-shadow:0 10px 25px rgba(0,0,0,.06);margin-bottom:20px
}
.filters-row{
  display:grid;grid-template-columns:2fr 1fr 1fr 1fr auto;gap:10px
}
.filters-row input,.filters-row select{
  padding:10px;border-radius:10px;border:1px solid #ddd
}
.btn-primary{
  background:#2563eb;color:#fff;border:none;
  padding:10px 18px;border-radius:10px;font-weight:800
}
.export-actions{margin-top:10px;display:flex;gap:10px}
.btn-export{
  padding:8px 14px;border-radius:10px;font-weight:800;
  text-decoration:none;color:#fff
}
.btn-export.excel{background:#16a34a}
.btn-export.pdf{background:#dc2626}

.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.card{
  background:#fff;border-radius:16px;padding:14px;
  box-shadow:0 8px 20px rgba(0,0,0,.06)
}
.card-top{display:flex;justify-content:space-between;font-weight:900}
.line{display:flex;justify-content:space-between;margin-top:6px;font-size:14px}
.rbtn{
  display:block;margin-top:10px;text-align:center;
  padding:8px;border-radius:10px;border:1px solid #cbd5e1;
  text-decoration:none;font-weight:800;color:#0f172a
}
@media(max-width:900px){
  .filters-row{grid-template-columns:1fr}
}