/* ===== RESET & VARIABLES ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green-900: #1B5E20;
    --green-800: #2E7D32;
    --green-700: #388E3C;
    --green-600: #43A047;
    --green-500: #4CAF50;
    --green-400: #66BB6A;
    --green-300: #81C784;
    --green-200: #A5D6A7;
    --green-100: #C8E6C9;
    --green-50: #E8F5E9;

    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    --gold: #F59E0B;
    --gold-dark: #D97706;
    --gold-light: #FEF3C7;

    --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-ar: 'Cairo', 'Inter', -apple-system, sans-serif;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);

    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --transition: 0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-en);
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

body.rtl {
    font-family: var(--font-ar);
    direction: rtl;
}

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

/* ===== TOP BAR ===== */
.topbar {
    background: var(--green-900);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--white);
}

.logo-icon { font-size: 24px; }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.logo-dot { color: var(--green-300); font-weight: 400; }

.lang-switch {
    display: flex;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.lang-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.lang-btn.active {
    background: var(--white);
    color: var(--green-900);
    border-radius: var(--radius-xs);
}

.lang-btn:hover:not(.active) {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

.topbar-premium-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--white);
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.topbar-premium-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

body.is-premium .topbar-premium-btn { display: none; }

/* ===== PLAN BANNER ===== */
.plan-banner {
    background: var(--gold-light);
    border-bottom: 1px solid #FDE68A;
    padding: 10px 0;
}

.plan-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.plan-badge {
    background: var(--gray-700);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.plan-badge.premium {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

.plan-info {
    font-size: 0.85rem;
    color: var(--gray-800);
    flex: 1;
}

.plan-upgrade-btn {
    background: var(--green-800);
    color: var(--white);
    border: none;
    padding: 7px 18px;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.plan-upgrade-btn:hover {
    background: var(--green-900);
    transform: translateY(-1px);
}

.premium-active {
    background: var(--green-50);
    border-bottom-color: var(--green-200);
}

body.is-premium .plan-banner:not(.premium-active) { display: none !important; }
body.is-premium .premium-active { display: block !important; }

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 50%, var(--green-700) 100%);
    padding: 60px 24px 80px;
    text-align: center;
    color: var(--white);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===== FEATURES GRID ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: -40px;
    margin-bottom: 32px;
    position: relative;
    z-index: 10;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 32px; margin-bottom: 8px; }
.feature-card h4 { font-size: 0.95rem; font-weight: 700; color: var(--green-800); margin-bottom: 4px; }
.feature-card p { font-size: 0.8rem; color: var(--gray-600); line-height: 1.4; }

/* ===== AD SLOTS ===== */
.ad-slot {
    margin-bottom: 20px;
}

.ad-container {
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-inline {
    margin-top: 8px;
}

.ad-placeholder {
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.is-premium .ad-slot,
body.is-premium .ad-container.ad-inline { display: none !important; }

/* ===== AI BAR ===== */
.ai-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

.ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--green-700), var(--green-600));
    color: var(--white);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    box-shadow: var(--shadow);
}

.ai-btn:hover { background: linear-gradient(135deg, var(--green-800), var(--green-700)); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ai-btn:active { transform: translateY(0); }
.ai-pulse { display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.ai-hint { font-size: 0.85rem; color: var(--gray-500); font-style: italic; }

/* ===== APP GRID ===== */
.app-main { padding-bottom: 64px; }
.app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

/* ===== LOGO UPLOAD ===== */
.logo-upload-area {
    margin-bottom: 16px;
}

.logo-upload-area > label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logo-dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    background: var(--gray-50);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-dropzone:hover {
    border-color: var(--green-500);
    background: var(--green-50);
}

.logo-dropzone.has-logo {
    border-style: solid;
    border-color: var(--green-300);
    background: var(--white);
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.logo-upload-icon {
    font-size: 24px;
    opacity: 0.6;
}

.logo-placeholder span:nth-child(2) {
    font-size: 0.82rem;
    color: var(--gray-500);
}

.premium-tag {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

body.is-premium .premium-tag { display: none; }

#logoPreviewImg {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
}

.logo-remove-btn {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 6px;
    padding: 4px 8px;
    transition: color var(--transition);
    font-family: inherit;
}

.logo-remove-btn:hover { color: #e53935; }

/* ===== COLOR PICKER (Premium) ===== */
.color-picker-area {
    margin-bottom: 16px;
}

.color-picker-area > label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.color-swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    outline: none;
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.color-swatch.active {
    border-color: var(--gray-900);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--gray-400);
}

.color-custom-wrap {
    position: relative;
}

.color-custom-input {
    width: 28px;
    height: 28px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
}

.color-custom-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-custom-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-custom-input::-moz-color-swatch { border: none; border-radius: 50%; }

.color-picker-area .premium-tag { margin-left: 4px; }

body.rtl .color-picker-area > label { letter-spacing: 0; }

/* ===== FORM CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--green-50);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row:last-child { margin-bottom: 0; }

.field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field input,
.field select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23757575'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

body.rtl .field select { background-position: left 12px center; padding-right: 14px; padding-left: 32px; }
.field input:focus, .field select:focus, textarea:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15); }
.field input[readonly] { background: var(--gray-50); color: var(--gray-600); cursor: default; }
textarea { resize: vertical; min-height: 80px; }

/* ===== LINE ITEMS ===== */
.items-header {
    display: grid;
    grid-template-columns: 1fr 70px 100px 100px 36px;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 8px;
}

.items-header span { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); }

.item-row {
    display: grid;
    grid-template-columns: 1fr 70px 100px 100px 36px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.item-row input {
    padding: 9px 10px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    color: var(--gray-900);
    background: var(--white);
}

.item-row input:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15); }

.item-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    padding: 9px 10px;
    text-align: right;
    background: var(--gray-50);
    border-radius: var(--radius-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.rtl .item-total { text-align: left; }

.remove-item-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: var(--gray-100); color: var(--gray-500); font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}

.remove-item-btn:hover { background: #ffebee; color: #e53935; }

.add-item-btn {
    display: flex; align-items: center; gap: 6px; background: none;
    border: 2px dashed var(--gray-300); color: var(--green-700);
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition); width: 100%;
    justify-content: center; font-family: inherit; margin-top: 8px;
}

.add-item-btn:hover { border-color: var(--green-500); background: var(--green-50); }

/* ===== SUGGESTIONS ===== */
.suggestions-dropdown {
    position: fixed; background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200;
    max-height: 180px; overflow-y: auto; display: none;
}

.suggestions-dropdown.visible { display: block; }

.suggestion-item {
    padding: 9px 14px; font-size: 0.85rem; cursor: pointer;
    transition: background var(--transition); border-bottom: 1px solid var(--gray-100);
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--green-50); color: var(--green-800); }

/* ===== PREVIEW COLUMN ===== */
.preview-sticky { position: sticky; top: 76px; }

.summary-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }

.summary-card {
    background: var(--white); border-radius: var(--radius-md);
    padding: 16px; text-align: center; box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200); transition: transform var(--transition);
}

.summary-card:hover { transform: translateY(-1px); }

.summary-card.highlight {
    background: var(--green-800); color: var(--white); border-color: var(--green-800);
}

.sum-label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; opacity: 0.7; }
.sum-value { display: block; font-size: 1.2rem; font-weight: 800; }
.summary-card.highlight .sum-label { color: var(--green-200); opacity: 1; }

/* ===== DOWNLOAD BUTTON ===== */
.download-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 14px 24px; background: var(--green-800); color: var(--white);
    border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: all var(--transition); font-family: inherit;
    margin-bottom: 16px; box-shadow: var(--shadow);
}

.download-btn:hover { background: var(--green-900); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.download-btn:active { transform: translateY(0); }
.download-btn.loading { opacity: 0.7; pointer-events: none; }

/* ===== PREVIEW SCROLL ===== */
.preview-scroll {
    max-height: calc(100vh - 340px); overflow-y: auto; border-radius: var(--radius-md);
    box-shadow: var(--shadow-md); border: 1px solid var(--gray-200);
}

.preview-scroll::-webkit-scrollbar { width: 6px; }
.preview-scroll::-webkit-scrollbar-track { background: var(--gray-100); }
.preview-scroll::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }

/* ===== INVOICE PAPER ===== */
.invoice-paper {
    background: var(--white); padding: 0; min-height: 600px;
    font-size: 13px; line-height: 1.5; color: var(--gray-900);
    position: relative; overflow: hidden;
}

/* Green top accent bar */
.inv-accent-bar {
    height: 6px;
    background: linear-gradient(90deg, #1B5E20, #43A047);
}

.inv-body { padding: 32px 36px 24px; }

/* Watermark */
.inv-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 56px;
    font-weight: 800;
    color: rgba(27, 94, 32, 0.06);
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
    user-select: none;
    font-family: 'Inter', sans-serif;
}

/* Invoice Logo */
.inv-logo { margin-bottom: 8px; }
.inv-logo img { max-width: 120px; max-height: 50px; object-fit: contain; }

/* Invoice Header — two columns */
.inv-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; padding-bottom: 22px;
    border-bottom: 2px solid #e0e0e0;
}

.inv-biz-name { font-size: 20px; font-weight: 800; color: #1B5E20; margin-bottom: 4px; }
.inv-biz-details p { font-size: 11px; color: #757575; margin-bottom: 1px; line-height: 1.6; }

.inv-title-block { text-align: right; }
.inv-title {
    font-size: 26px; font-weight: 800; color: #1B5E20;
    margin-bottom: 12px; text-transform: uppercase;
}

.inv-meta-table { border-collapse: collapse; }
.inv-meta-table td {
    font-size: 11.5px; padding: 3px 0; vertical-align: top;
}
.inv-meta-label {
    color: #9e9e9e; font-weight: 600; white-space: nowrap;
}
.inv-meta-value {
    color: #424242; font-weight: 600;
    padding-left: 12px;
}

/* Bill To section */
.inv-two-col {
    display: flex; gap: 24px;
    margin-bottom: 24px;
}

.inv-from-box, .inv-to-box {
    flex: 1; padding: 16px 18px;
    border-radius: 6px;
}

.inv-from-box { background: #f5f5f5; }
.inv-to-box { background: #E8F5E9; }

.inv-section-label {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    color: #9e9e9e; margin-bottom: 8px;
}
.inv-to-box .inv-section-label { color: #2E7D32; }

.inv-person-name {
    font-size: 14px; font-weight: 700; color: #212121; margin-bottom: 4px;
}
.inv-person-details p {
    font-size: 11px; color: #616161; margin-bottom: 1px; line-height: 1.5;
}

/* Items Table */
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.inv-table th {
    background: #1B5E20; color: #ffffff;
    padding: 11px 14px; font-size: 10px; font-weight: 700;
    text-transform: uppercase; text-align: left;
}
.inv-table th:first-child { border-radius: 6px 0 0 0; }
.inv-table th:last-child { border-radius: 0 6px 0 0; text-align: right; }

.inv-table td {
    padding: 12px 14px; font-size: 12.5px;
    border-bottom: 1px solid #eeeeee;
}
.inv-table tbody tr:nth-child(even) { background: #fafafa; }
.inv-table tbody tr:hover { background: #f5f5f5; }
.inv-table .col-num { width: 36px; text-align: center; color: #9e9e9e; font-size: 11px; }
.inv-table .col-qty { width: 60px; text-align: center; }
.inv-table .col-price { width: 100px; text-align: right; }
.inv-table .col-total { width: 100px; text-align: right; font-weight: 700; color: #212121; }

/* Totals */
.inv-totals-wrapper {
    display: flex; justify-content: flex-end; margin-bottom: 24px;
}
.inv-totals {
    width: 260px; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden;
}
.inv-total-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 16px; font-size: 12.5px;
    border-bottom: 1px solid #eeeeee;
}
.inv-total-row:last-child { border-bottom: none; }
.inv-total-row .tr-label { color: #757575; }
.inv-total-row .tr-value { font-weight: 600; color: #424242; }
.inv-total-row.grand {
    background: #1B5E20; border-bottom: none;
}
.inv-total-row.grand .tr-label { color: #C8E6C9; font-weight: 700; font-size: 13px; }
.inv-total-row.grand .tr-value { color: #ffffff; font-weight: 800; font-size: 16px; }

/* Notes */
.inv-notes {
    padding: 14px 18px; background: #fafafa; border-radius: 6px;
    margin-bottom: 20px; border-left: 3px solid #43A047;
}
.inv-notes-title {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    color: #9e9e9e; margin-bottom: 6px;
}
.inv-notes p { font-size: 11.5px; color: #616161; white-space: pre-line; line-height: 1.6; }

/* Footer */
.inv-footer {
    text-align: center; padding-top: 16px;
    border-top: 1px solid #eeeeee;
}
.inv-footer p { font-size: 10.5px; color: #bdbdbd; }

/* ===== RTL INVOICE ===== */
.invoice-paper[dir="rtl"] { font-family: var(--font-ar); }
.invoice-paper[dir="rtl"] .inv-accent-bar {
    background: linear-gradient(270deg, #1B5E20, #43A047);
}
.invoice-paper[dir="rtl"] .inv-title-block { text-align: left; }
.invoice-paper[dir="rtl"] .inv-title { letter-spacing: 0; }
.invoice-paper[dir="rtl"] .inv-meta-value { padding-left: 0; padding-right: 12px; }
.invoice-paper[dir="rtl"] .inv-notes { border-left: none; border-right: 3px solid #43A047; }
.invoice-paper[dir="rtl"] .inv-table th { text-align: right; }
.invoice-paper[dir="rtl"] .inv-table th:first-child { border-radius: 0 6px 0 0; }
.invoice-paper[dir="rtl"] .inv-table th:last-child { border-radius: 6px 0 0 0; text-align: left; }
.invoice-paper[dir="rtl"] .inv-table .col-price { text-align: left; }
.invoice-paper[dir="rtl"] .inv-table .col-total { text-align: left; }
.invoice-paper[dir="rtl"] .inv-totals-wrapper { justify-content: flex-start; }
/* RTL: no letter-spacing on any invoice text (breaks Arabic ligatures) */
.invoice-paper[dir="rtl"] .inv-section-label,
.invoice-paper[dir="rtl"] .inv-notes-title,
.invoice-paper[dir="rtl"] .inv-table th,
.invoice-paper[dir="rtl"] .inv-meta-label { letter-spacing: 0; text-transform: none; }

/* ===== PRINT AREA ===== */
#printArea { display: none; }

/* ===== UPGRADE MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
    padding: 24px; backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

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

.modal-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 36px;
    max-width: 440px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-card.limit-modal {
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    font-size: 28px; color: var(--gray-400);
    cursor: pointer; transition: color var(--transition);
    line-height: 1;
}

body.rtl .modal-close { right: auto; left: 16px; }

.modal-close:hover { color: var(--gray-800); }

.modal-header { text-align: center; margin-bottom: 24px; }
.modal-star { font-size: 40px; display: block; margin-bottom: 8px; }
.modal-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--gray-900); margin-bottom: 8px; }
.modal-header p { font-size: 0.9rem; color: var(--gray-600); }

.pricing-box {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--green-50);
    border-radius: var(--radius-sm);
}

.pricing-dollar {
    font-size: 3rem;
    font-weight: 800;
    color: var(--green-800);
    line-height: 1;
}

.pricing-period {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

.modal-features {
    list-style: none;
    margin-bottom: 24px;
}

.modal-features li {
    padding: 8px 0;
    font-size: 0.92rem;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--green-700), var(--green-600));
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
}

.checkout-btn:hover {
    background: linear-gradient(135deg, var(--green-800), var(--green-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.license-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--gray-400);
    font-size: 0.82rem;
}

.license-section { text-align: center; }
.license-section > p { font-size: 0.82rem; color: var(--gray-600); margin-bottom: 10px; }

.license-input-row {
    display: flex;
    gap: 8px;
}

.license-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    font-family: monospace;
    text-align: center;
    outline: none;
    letter-spacing: 1px;
}

.license-input-row input:focus { border-color: var(--green-500); }

.license-activate-btn {
    background: var(--green-800);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: 0.85rem;
}

.license-activate-btn:hover { background: var(--green-900); }

.license-error {
    color: #e53935;
    font-size: 0.8rem;
    margin-top: 8px;
}

.limit-hint {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-top: 16px;
}

/* ===== PAGE FOOTER ===== */
.footer {
    background: var(--green-900);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 24px;
    margin-top: 48px;
}

.footer p { font-size: 0.85rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .app-grid { grid-template-columns: 1fr; }
    .preview-sticky { position: static; }
    .preview-scroll { max-height: none; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .hero { padding: 40px 16px 60px; }
    .hero h1 { font-size: 1.7rem; }
    .hero p { font-size: 0.95rem; }
    .container { padding: 0 16px; }
    .features-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: -30px; }
    .feature-card { padding: 16px 12px; }
    .feature-icon { font-size: 24px; }
    .form-row { grid-template-columns: 1fr; }
    .items-header { display: none; }
    .item-row {
        grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px;
        background: var(--gray-50); border-radius: var(--radius-sm);
        margin-bottom: 12px; border: 1px solid var(--gray-200);
    }
    .item-row .desc-input { grid-column: 1 / -1; }
    .item-row .remove-item-btn { grid-column: 1 / -1; width: 100%; border-radius: var(--radius-xs); height: auto; padding: 6px; }
    .summary-row { grid-template-columns: 1fr; gap: 8px; }
    .inv-body { padding: 20px; }
    .inv-header { flex-direction: column; gap: 16px; }
    .inv-title-block { text-align: left; }
    .invoice-paper[dir="rtl"] .inv-title-block { text-align: right; }
    .inv-title { font-size: 22px; }
    .inv-two-col { flex-direction: column; gap: 12px; }
    .ai-bar { flex-direction: column; align-items: stretch; }
    .ai-hint { text-align: center; }
    .card { padding: 18px; }
    .topbar-inner { height: 52px; }
    .logo-text { font-size: 17px; }
    .lang-btn { padding: 6px 14px; font-size: 13px; }
    .topbar-premium-btn { padding: 6px 12px; font-size: 12px; }
    .plan-banner-inner { justify-content: center; text-align: center; }
    .modal-card { padding: 24px; margin: 16px; }
    .inv-watermark { font-size: 36px; }
    .license-input-row { flex-direction: column; }
}

/* RTL: reset letter-spacing for Arabic ligatures */
body.rtl .hero h1 { letter-spacing: 0; }
body.rtl .plan-badge { letter-spacing: 0; }
body.rtl .ad-placeholder { letter-spacing: 0; }
body.rtl .logo-upload-area > label { letter-spacing: 0; }
body.rtl .field label { letter-spacing: 0; }
body.rtl .items-header span { letter-spacing: 0; }
body.rtl .sum-label { letter-spacing: 0; }
body.rtl .license-input-row input { letter-spacing: 0; }

/* Print now happens in a separate window — no @media print needed here */
