/* ===============================================
   DF SOFTWARE INVOICE SYSTEM
   =============================================== */

:root {
    --primary: #0f2942;
    --primary-light: #1a3d5c;
    --accent: #0066cc;
    --white: #ffffff;
    --border: #e2e8f0;
    --text: #1a1a1a;
    --text-muted: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #000;
    background: #f5f5f5;
    padding: 15px;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    padding: 40px 36px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
}

.login-box h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 4px 0;
    text-align: center;
}

.login-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
}

.login-form .field {
    margin-bottom: 16px;
}

.login-form .field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    color: #dc2626;
    font-size: 12px;
    margin-bottom: 12px;
    min-height: 18px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-login:hover {
    background: var(--primary-light);
}

/* ===== HOME PAGE ===== */
.invoice-home {
    max-width: 420px;
    margin: 100px auto;
    text-align: center;
    background: var(--white);
    padding: 48px 44px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 10px 20px -5px rgba(0,0,0,0.08);
}

.invoice-home h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.invoice-home p {
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 14px;
}

.invoice-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invoice-links a {
    display: block;
    padding: 14px 24px;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, box-shadow 0.2s;
}

.invoice-links a:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(15, 41, 66, 0.25);
}

.invoice-links a:last-child {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.invoice-links a:last-child:hover {
    background: rgba(15, 41, 66, 0.04);
}

/* ===== INVOICE PAGE ===== */
.invoice-page {
    max-width: 880px;
    margin: 0 auto;
    background: var(--white);
    padding: 44px 56px;
    box-shadow: 0 2px 8px rgba(15, 41, 66, 0.06), 0 24px 48px -12px rgba(0,0,0,0.1);
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.invoice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.invoice-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
}

.invoice-actions .btn:hover {
    opacity: 0.92;
    transform: translateY(-0.5px);
}

.btn-print  { background: var(--primary); color: var(--white); }
.btn-shipping { background: var(--accent); color: var(--white); }
.btn-back   { background: var(--border); color: var(--text); }

/* ===== HEADER ===== */
.company-name-top {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-row .invoice-type {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.header-row .invoice-logo {
    max-height: 52px;
    width: auto;
    object-fit: contain;
}

.header-line {
    height: 2px;
    background: var(--primary);
    margin: 16px 0 24px 0;
}

/* ===== META ROW ===== */
.invoice-meta-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.meta-label {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    min-width: 140px;
}

.meta-input-inline {
    border: 1px solid #333;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    color: #000;
    background: #fff;
    font-family: inherit;
}

.meta-input-inline:focus {
    outline: none;
    border-color: #000;
    background: #f9f9f9;
}

/* ===== INVOICE BODY ===== */
.invoice-body-purchase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.invoice-block h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #000;
    margin: 0 0 12px 0;
}

.invoice-block input,
.invoice-block textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    color: #000;
}

.invoice-block input:focus,
.invoice-block textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.invoice-block textarea {
    min-height: 40px;
    resize: vertical;
}

.invoice-block label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-block .field {
    margin-bottom: 10px;
}

.invoice-block .field:last-child {
    margin-bottom: 0;
}

.company-info {
    font-size: 14px;
    color: #000;
    line-height: 1.7;
    font-weight: 500;
}

/* ===== TABLE ===== */
.invoice-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    border: 1px solid #333;
}

.invoice-table th,
.invoice-table td {
    padding: 10px 14px;
    border: 1px solid #333;
    text-align: left;
    color: #000;
    font-weight: 500;
}

.invoice-table thead th {
    background: #333;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-table tbody tr:nth-child(even) {
    background: #f0f0f0;
}

.invoice-table input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #333;
    font-size: 14px;
    font-family: inherit;
    color: #000;
    font-weight: 500;
}

.invoice-table input:focus {
    outline: none;
    border-color: var(--accent);
}

.invoice-table .col-desc  { min-width: 180px; }
.invoice-table .col-price { width: 100px; text-align: right; }
.invoice-table .col-qty   { width: 70px;  text-align: center; }
.invoice-table .col-amount{ width: 100px; text-align: right; font-weight: 600; }

/* ===== TOTALS ===== */
.totals-table {
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-bottom: 24px;
    border-collapse: collapse;
    border: 1px solid #333;
}

.totals-table td {
    padding: 6px 12px;
    border: 1px solid #999;
}

.totals-table td:first-child { font-weight: 600; }
.totals-table td:last-child  { text-align: right; }

.totals-table .total-row td {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    background: #f5f7fa;
}

.totals-table input[type="number"] {
    width: 65px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: right;
}

/* ===== FOOTER ===== */
.invoice-footer {
    margin-top: 36px;
    padding-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.invoice-footer.no-border { border-top: none; }

.invoice-seal { text-align: center; }

.invoice-seal img {
    max-width: 320px;
    width: 100%;
    height: auto;
}

/* ===============================================
   PRINT STYLES
   =============================================== */
@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    html { font-size: 11px; }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ── إخفاء الأزرار والعناصر اللي مش محتاجها ── */
    .invoice-actions,
    .no-print {
        display: none !important;
    }

    /* ── الصفحة نفسها ── */
    .invoice-page {
        max-width: none !important;
        width: 100% !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
    }

    /* ── الهيدر ── */
    .company-name-top { font-size: 14px; }

    .header-row .invoice-type {
        font-size: 16px;
        color: #000;
    }

    .header-line {
        background: #000 !important;
        margin: 10px 0 14px 0;
    }

    /* ── Meta inputs: نخفي الـ border ونخلي الخلفية شفافة ── */
    .meta-label {
        font-size: 11px !important;
        min-width: 110px;
    }

    .meta-input-inline {
        border: none !important;
        background: transparent !important;
        padding: 2px 4px !important;
        font-size: 12px !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    /* ── Invoice blocks inputs ── */
    .invoice-block h3   { font-size: 10px; margin-bottom: 6px; }
    .invoice-block label { font-size: 10px; margin-bottom: 2px; }

    .invoice-block .field { margin-bottom: 5px; }

    .invoice-block input,
    .invoice-block textarea {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 2px 4px !important;
        font-size: 11px !important;
        color: #000 !important;
        resize: none !important;
    }

    .company-info {
        font-size: 11px;
        line-height: 1.5;
    }

    /* ── الجدول ── */
    .invoice-table-wrap { margin-bottom: 10px; }

    .invoice-table {
        font-size: 10px;
        border: 1px solid #000 !important;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 5px 8px;
        border: 1px solid #666 !important;
    }

    .invoice-table thead th {
        font-size: 9px;
        background: #333 !important;
        color: #fff !important;
    }

    /* inputs داخل الجدول: نخفيها ونخلي القيمة تظهر بس */
    .invoice-table input {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        font-size: 10px !important;
        color: #000 !important;
    }

    .invoice-table tbody tr:nth-child(even) {
        background: #f5f5f5 !important;
    }

    /* ── Totals ── */
    .totals-table {
        margin-bottom: 12px;
        border: 1px solid #000 !important;
    }

    .totals-table td {
        font-size: 10px;
        padding: 4px 8px;
        border: 1px solid #000 !important;
    }

    .totals-table .total-row td {
        font-size: 11px;
        background: #eee !important;
        color: #000 !important;
    }

    .totals-table input[type="number"] {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        font-size: 10px !important;
        color: #000 !important;
    }

    /* ── Footer ── */
    .invoice-footer {
        margin-top: 16px;
        padding-top: 16px;
    }

    .invoice-footer.no-border { border-top: none !important; }

    .invoice-seal img {
        max-width: 250px !important;
        width: 250px !important;
    }
}