/* ============================================ */
/* RECEIPT GENERATOR - STANDALONE CSS */
/* ============================================ */

:root {
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #059669;
  --accent-light: #d1fae5;
  --accent-dark: #047857;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  --accent: #10b981;
  --accent-light: #064e3b;
  --accent-dark: #34d399;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ============================================ */
/* NAVBAR */
/* ============================================ */
.navbar { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; box-shadow: var(--shadow); }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-logo { font-size: 1.35rem; font-weight: 800; color: var(--accent); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger { display: block; width: 24px; height: 2px; background: var(--text); position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; width: 24px; height: 2px; background: var(--text); left: 0; }
.hamburger::before { top: -8px; }
.hamburger::after { top: 8px; }
.nav-menu { display: flex; list-style: none; gap: 8px; align-items: center; }
.nav-menu li { list-style: none; }
.nav-menu a { padding: 8px 14px; color: var(--text); font-weight: 500; font-size: 0.95rem; border-radius: var(--radius); transition: all 0.15s ease; text-decoration: none; display: inline-block; }
.nav-menu a:hover, .nav-menu a.active { background: var(--bg-secondary); color: var(--accent); text-decoration: none; }
.nav-dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; }
.dropdown-menu { position: absolute; top: 100%; left: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-width: 260px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); display: none; z-index: 100; }
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-category { padding: 8px 0; }
.category-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 8px; margin-bottom: 4px; }
.dropdown-tools { list-style: none; }
.dropdown-tools li { list-style: none; }
.dropdown-tools a { display: block; padding: 6px 12px; font-size: 0.9rem; color: var(--text-secondary); }
.dropdown-tools a:hover { background: var(--bg-secondary); color: var(--accent); }
.dropdown-divider { height: 1px; background: var(--border); margin: 8px 0; }
.view-all { display: block; padding: 8px 12px; font-weight: 600; color: var(--accent); text-align: center; }
.theme-toggle { background: none; border: none; cursor: pointer; padding: 8px; font-size: 1.1rem; border-radius: var(--radius); }
.nav-theme-item { list-style: none; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-menu { position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-card); flex-direction: column; padding: 20px; border-top: 1px solid var(--border); display: none; align-items: stretch; gap: 4px; }
  .nav-menu.active { display: flex; }
  .nav-dropdown:hover .dropdown-menu { position: static; display: block; box-shadow: none; border: none; padding-left: 16px; }
  .nav-menu a { display: block; width: 100%; }
}

/* ============================================ */
/* HERO */
/* ============================================ */
.rec-hero { padding: 60px 0 40px; text-align: center; background: linear-gradient(135deg, #ecfdf5 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
[data-theme="dark"] .rec-hero { background: linear-gradient(135deg, #064e3b 0%, var(--bg) 100%); }
.rec-hero h1 { font-size: 2.5rem; margin-bottom: 16px; font-weight: 800; }
.rec-hero-subtitle { font-size: 1.1rem; color: var(--text-secondary); max-width: 720px; margin: 0 auto 24px; line-height: 1.6; }
.rec-hero-badge { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; font-size: 0.95rem; color: var(--text-secondary); }

/* ============================================ */
/* FORM */
/* ============================================ */
.rec-form-section { padding: 60px 0; }
.rec-form-wrapper { max-width: 950px; margin: 0 auto; }
.rec-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.rec-section legend { font-weight: 700; font-size: 1.1rem; color: var(--text); padding: 0 8px; margin-left: -8px; }
.rec-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.rec-row:last-child { margin-bottom: 0; }
.rec-row:has(.rec-group:nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }
.rec-row:has(.rec-group:nth-child(1):last-child) { grid-template-columns: 1fr; }
.rec-group { display: flex; flex-direction: column; }
.rec-group.full-width { grid-column: 1 / -1; }
.rec-group label { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--text); }
.rec-group input, .rec-group select, .rec-group textarea { width: 100%; padding: 10px 14px; font-size: 0.95rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-family: inherit; transition: border-color 0.15s ease; }
.rec-group input:focus, .rec-group select:focus, .rec-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1); }
.rec-group textarea { resize: vertical; min-height: 70px; }

/* Logo Upload */
.logo-upload-group { grid-column: 1 / -1; }
.logo-upload-wrapper { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logo-upload-wrapper input[type="file"] { display: none; }
.logo-upload-btn, .logo-remove-btn { padding: 8px 16px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; cursor: pointer; font-family: inherit; transition: all 0.15s ease; border: 1px solid var(--border); }
.logo-upload-btn { background: var(--accent); color: white; border-color: var(--accent); }
.logo-upload-btn:hover { background: var(--accent-dark); }
.logo-remove-btn { background: var(--bg-secondary); color: var(--danger); border-color: var(--danger); }
.logo-remove-btn:hover { background: var(--danger); color: white; }
.logo-preview { max-height: 60px; display: flex; align-items: center; }
.logo-preview img { max-height: 60px; width: auto; border-radius: 4px; }

/* Items Table */
.rec-items-wrapper { overflow-x: auto; margin-bottom: 16px; }
.rec-items-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.rec-items-table th { background: var(--bg-secondary); padding: 10px 12px; text-align: left; font-weight: 700; font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.rec-items-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.rec-items-table input { width: 100%; padding: 8px 10px; font-size: 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-family: inherit; }
.rec-items-table input:focus { outline: none; border-color: var(--accent); }
.rec-items-table .item-desc { min-width: 220px; }
.rec-items-table .item-qty { width: 80px; }
.rec-items-table .item-price { width: 120px; }
.rec-items-table .item-amount { width: 120px; text-align: right; padding-right: 12px; font-weight: 600; color: var(--text); }
.rec-remove-item { background: none; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.1rem; transition: all 0.15s ease; font-family: inherit; }
.rec-remove-item:hover { background: var(--danger); color: white; border-color: var(--danger); }
.rec-add-btn { width: 100%; padding: 12px; background: var(--bg-secondary); border: 1px dashed var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--text-secondary); font-family: inherit; transition: all 0.15s ease; }
.rec-add-btn:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

/* ============================================ */
/* ACTION BUTTONS */
/* ============================================ */
.rec-actions { padding: 0 0 40px; }
.rec-actions-bar { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.rec-action-btn { padding: 12px 24px; font-size: 0.95rem; font-weight: 600; border-radius: var(--radius); border: none; cursor: pointer; transition: all 0.15s ease; font-family: inherit; }
.rec-action-btn.primary { background: var(--accent); color: white; }
.rec-action-btn.primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3); }
.rec-action-btn.secondary { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }
.rec-action-btn.secondary:hover { background: var(--bg); border-color: var(--accent); }

/* ============================================ */
/* PREVIEW */
/* ============================================ */
.rec-preview-section { padding: 0 0 60px; }
.rec-preview-section h2 { font-size: 1.5rem; margin-bottom: 24px; text-align: center; font-weight: 700; }
.rec-preview-wrapper { max-width: 900px; margin: 0 auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); overflow-x: auto; }
.rec-document { background: white; color: #1e293b; padding: 40px; min-height: 500px; font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 14px; line-height: 1.5; }
[data-theme="dark"] .rec-document { background: white; color: #1e293b; }

/* Receipt document styling */
.rd-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 2px solid #059669; }
.rd-logo img { max-height: 60px; }
.rd-title { text-align: right; }
.rd-title h2 { font-size: 28px; font-weight: 800; color: #059669; letter-spacing: 2px; margin-bottom: 4px; }
.rd-title p { font-size: 12px; color: #64748b; }
.rd-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.rd-party h4 { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.rd-party p { font-size: 13px; line-height: 1.6; color: #1e293b; }
.rd-party strong { font-weight: 700; }
.rd-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; padding: 16px; background: #f0fdf4; border-radius: 6px; }
.rd-meta-item label { font-size: 10px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.rd-meta-item span { font-size: 13px; font-weight: 600; color: #1e293b; }
.rd-items { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.rd-items th { background: #059669; color: white; padding: 10px 12px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.rd-items td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.rd-items .text-right { text-align: right; }
.rd-items .amount { font-weight: 700; }
.rd-totals { display: flex; justify-content: flex-end; margin-bottom: 24px; }
.rd-totals-table { width: 320px; }
.rd-totals-table tr td { padding: 8px 12px; font-size: 13px; }
.rd-totals-table tr td:first-child { color: #64748b; }
.rd-totals-table tr td:last-child { text-align: right; font-weight: 600; }
.rd-totals-table .grand-total td { font-size: 16px; font-weight: 800; color: #059669; border-top: 2px solid #059669; padding-top: 10px; }
.rd-amount-words { padding: 12px 16px; background: #f0fdf4; border-left: 3px solid #059669; border-radius: 4px; margin-bottom: 24px; font-size: 12px; }
.rd-amount-words strong { color: #059669; }
.rd-payment-badge { display: inline-block; padding: 4px 12px; background: #059669; color: white; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.rd-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid #e2e8f0; font-size: 11px; color: #64748b; line-height: 1.6; }
.rd-footer h4 { font-size: 12px; font-weight: 700; color: #1e293b; margin-bottom: 6px; text-transform: uppercase; }
.rd-footer p { margin-bottom: 8px; }
.rd-signature { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 20px; }
.rd-signature-block { text-align: center; width: 200px; }
.rd-signature-line { border-top: 1px solid #1e293b; padding-top: 8px; font-size: 11px; color: #1e293b; font-weight: 600; }
.rd-stamp { text-align: center; font-size: 10px; color: #059669; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-top: 20px; }

/* ============================================ */
/* CONTENT */
/* ============================================ */
.rec-content-article { padding: 60px 0; background: var(--bg-secondary); border-top: 1px solid var(--border); }
.rec-content-article h2 { font-size: 2rem; margin-bottom: 20px; font-weight: 700; }
.rec-content-article h3 { font-size: 1.35rem; margin: 32px 0 16px; font-weight: 700; }
.rec-content-article p { color: var(--text-secondary); line-height: 1.8; margin-bottom: 16px; }
.rec-content-article ul, .rec-content-article ol { margin-left: 24px; color: var(--text-secondary); line-height: 1.9; margin-bottom: 16px; }
.rec-content-article li { padding: 4px 0; }
.rec-internal-links { margin-top: 40px; padding: 24px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.rec-internal-links h3 { margin-top: 0; }
.rec-internal-links ul { list-style: none; margin: 0; padding: 0; }
.rec-internal-links li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.rec-internal-links li:last-child { border-bottom: none; }
.rec-internal-links a { color: var(--accent); font-weight: 600; }

/* ============================================ */
/* FAQ */
/* ============================================ */
.rec-faq { padding: 60px 0; }
.rec-faq h2 { text-align: center; margin-bottom: 40px; font-size: 1.75rem; font-weight: 700; }
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-question { width: 100%; background: none; border: none; padding: 18px 0; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 1.02rem; font-weight: 600; color: var(--text); font-family: inherit; }
.faq-question:hover { color: var(--accent); }
.faq-icon { font-size: 1.5rem; font-weight: 300; color: var(--accent); flex-shrink: 0; line-height: 1; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.faq-answer p { padding: 0 0 18px; color: var(--text-secondary); line-height: 1.7; font-size: 0.95rem; }

/* ============================================ */
/* FOOTER */
/* ============================================ */
.footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 48px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand p { color: var(--text-secondary); margin-top: 12px; font-size: 0.95rem; line-height: 1.6; }
.footer-logo { font-size: 1.35rem; font-weight: 800; color: var(--accent); }
.footer-tagline { font-weight: 600; color: var(--accent); margin-top: 8px; }
.footer-nav ul { list-style: none; padding: 0; }
.footer-nav li { margin-bottom: 8px; list-style: none; }
.footer-nav a { color: var(--text-secondary); font-size: 0.92rem; text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }
.footer-privacy { margin-top: 6px; font-size: 0.82rem; }

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */
@media (max-width: 900px) {
  .rec-hero h1 { font-size: 2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .rd-parties { grid-template-columns: 1fr; }
  .rd-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .rec-hero { padding: 40px 0 30px; }
  .rec-hero h1 { font-size: 1.75rem; }
  .rec-row { grid-template-columns: 1fr; }
  .rec-section { padding: 20px; }
  .rec-actions-bar { flex-direction: column; }
  .rec-action-btn { width: 100%; }
  .rec-preview-wrapper { padding: 16px; }
  .rec-document { padding: 20px; }
  .rd-header { flex-direction: column; }
  .rd-title { text-align: left; margin-top: 16px; }
  .rd-meta { grid-template-columns: 1fr; }
  .rd-signature { flex-direction: column; gap: 24px; align-items: center; }
  .rec-items-table th, .rec-items-table td { padding: 6px 4px; font-size: 0.8rem; }
  .rec-items-table .item-desc { min-width: 120px; }
}