/* ============================================
   STax Feenote Generator v2.0 - CSS Design System
   ============================================ */

:root {
    /* Color Palette */
    --primary-h: 245;
    --primary-s: 75%;
    --primary: hsl(var(--primary-h), var(--primary-s), 60%);
    --primary-light: hsl(var(--primary-h), var(--primary-s), 70%);
    --primary-dark: hsl(var(--primary-h), var(--primary-s), 45%);
    --primary-glow: hsla(var(--primary-h), var(--primary-s), 60%, 0.25);

    --accent: hsl(280, 70%, 60%);
    --accent-glow: hsla(280, 70%, 60%, 0.2);

    --success: hsl(155, 65%, 48%);
    --success-light: hsl(155, 65%, 90%);
    --warning: hsl(38, 92%, 55%);
    --warning-light: hsl(38, 92%, 90%);
    --danger: hsl(0, 72%, 56%);

    --excel-green: hsl(140, 65%, 42%);
    --excel-glow: hsla(140, 65%, 42%, 0.25);

    /* Dark Theme (default) */
    --bg-body: hsl(228, 25%, 8%);
    --bg-surface: hsl(228, 22%, 11%);
    --bg-card: hsl(228, 20%, 14%);
    --bg-card-hover: hsl(228, 20%, 17%);
    --bg-input: hsl(228, 22%, 10%);
    --bg-input-focus: hsl(228, 22%, 12%);

    --border: hsla(228, 30%, 30%, 0.4);
    --border-strong: hsla(228, 30%, 40%, 0.5);
    --border-focus: var(--primary);

    --text-primary: hsl(228, 15%, 93%);
    --text-secondary: hsl(228, 12%, 62%);
    --text-muted: hsl(228, 10%, 45%);
    --text-inverse: hsl(228, 20%, 10%);

    --shadow-sm: 0 1px 3px hsla(0, 0%, 0%, 0.3);
    --shadow-md: 0 4px 16px hsla(0, 0%, 0%, 0.35);
    --shadow-lg: 0 8px 32px hsla(0, 0%, 0%, 0.45);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
[data-theme="light"] {
    --bg-body: hsl(228, 25%, 96%);
    --bg-surface: hsl(228, 20%, 98%);
    --bg-card: hsl(0, 0%, 100%);
    --bg-card-hover: hsl(228, 20%, 97%);
    --bg-input: hsl(228, 20%, 96%);
    --bg-input-focus: hsl(0, 0%, 100%);

    --border: hsla(228, 20%, 80%, 0.5);
    --border-strong: hsla(228, 20%, 70%, 0.5);

    --text-primary: hsl(228, 25%, 12%);
    --text-secondary: hsl(228, 12%, 45%);
    --text-muted: hsl(228, 10%, 62%);

    --shadow-sm: 0 1px 3px hsla(228, 20%, 30%, 0.08);
    --shadow-md: 0 4px 16px hsla(228, 20%, 30%, 0.1);
    --shadow-lg: 0 8px 32px hsla(228, 20%, 30%, 0.12);
    --shadow-glow: 0 0 20px hsla(var(--primary-h), var(--primary-s), 60%, 0.1);
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Background Effects
   ============================================ */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--success);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ============================================
   Header
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: hsla(228, 22%, 11%, 0.75);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .app-header {
    background: hsla(0, 0%, 100%, 0.8);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-img {
    height: 40px;
    width: auto;
    transition: transform var(--transition-base);
}

.logo-group:hover .logo-img {
    transform: rotate(-3deg) scale(1.05);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

/* ============================================
   Main Layout
   ============================================ */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* ============================================
   Section Cards
   ============================================ */
.form-section,
.preview-section,
.history-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    animation: slideUp 0.5s ease-out;
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.section-badge {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), 60%, 0.15), hsla(var(--primary-h), var(--primary-s), 60%, 0.05));
    color: var(--primary);
    flex-shrink: 0;
}

.section-badge-green {
    background: linear-gradient(135deg, hsla(155, 65%, 48%, 0.15), hsla(155, 65%, 48%, 0.05));
    color: var(--success);
}

.section-badge-amber {
    background: linear-gradient(135deg, hsla(38, 92%, 55%, 0.15), hsla(38, 92%, 55%, 0.05));
    color: var(--warning);
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

.section-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* ============================================
   Form Styles
   ============================================ */
.feenote-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.form-row {
    display: grid;
    gap: var(--space-md);
}

.form-row-2 {
    grid-template-columns: 1fr 1fr;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auto-seq-hint {
    color: var(--success);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    font-family: var(--font-sans);
    font-size: 0.93rem;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: var(--bg-input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Date picker indicator customization */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.8) brightness(1.2); /* Make it lighter for dark mode */
    padding: 2px;
    margin-right: -2px;
    transform: scale(1.2);
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0) brightness(0.4); /* Darker for light mode */
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.contact-input-group {
    display: flex;
    width: 100%;
}

.prefix-select {
    width: 100px;
    flex-shrink: 0;
}

.prefix-select select {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

#contactPerson {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Form Divider */
.form-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-sm) 0;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-divider span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

/* Feenote Number Display */
.feenote-number-display {
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), 60%, 0.08), hsla(280, 70%, 60%, 0.05));
    border: 1px solid hsla(var(--primary-h), var(--primary-s), 60%, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.feenote-num {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.08em;
    transition: transform var(--transition-fast);
}

/* ============================================
   Multiple Services
   ============================================ */
#servicesContainer {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.service-row {
    animation: slideUp 0.3s ease-out;
}

.form-row-service {
    display: grid;
    grid-template-columns: 1fr 200px 36px;
    gap: var(--space-md);
    align-items: end;
}

.btn-remove-service {
    width: 36px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 1px;
}

.btn-remove-service:hover {
    background: hsla(0, 72%, 56%, 0.1);
    border-color: hsla(0, 72%, 56%, 0.3);
    color: var(--danger);
}

.btn-add-service {
    align-self: flex-start;
    padding: 8px 16px;
    font-size: 0.82rem;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-add-service:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: hsla(var(--primary-h), var(--primary-s), 60%, 0.05);
}

/* ============================================
   Totals Panel
   ============================================ */
.totals-panel {
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), 60%, 0.05), hsla(155, 65%, 48%, 0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-sm);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.totals-row + .totals-row {
    border-top: 1px solid hsla(228, 30%, 30%, 0.15);
}

.totals-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.totals-grand {
    padding-top: 10px;
    margin-top: 4px;
    border-top: 2px solid var(--primary) !important;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.totals-grand .totals-value {
    font-size: 1.15rem;
    color: var(--success);
}

.vat-inline {
    width: 60px;
    padding: 2px 6px;
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    color: var(--primary-light);
    font-family: var(--font-mono);
    outline: none;
    text-align: center;
}

.vat-inline:focus {
    border-color: var(--primary);
}

/* ============================================
   Buttons
   ============================================ */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px var(--primary-glow), var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-export {
    background: linear-gradient(135deg, var(--excel-green), hsl(155, 55%, 38%));
    color: white;
    box-shadow: 0 2px 12px var(--excel-glow);
}

.btn-export:hover {
    box-shadow: 0 4px 20px var(--excel-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-ghost:hover {
    color: var(--danger);
    background: hsla(0, 72%, 56%, 0.08);
}

.btn-ghost-light {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 0.82rem;
}

.btn-ghost-light:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
}

.preview-actions {
    margin-left: auto;
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ============================================
   Feenote Preview (Print-ready)
   ============================================ */
.feenote-preview-wrapper {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.feenote-preview {
    background: white;
    color: #1a1a2e;
    padding: 30px 45px;
    font-family: 'Times New Roman', serif;
    font-size: 11.5pt;
    line-height: 1.5;
    min-height: auto;
}

.fn-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2d2d6e;
}

.fn-logo-block {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

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

.fn-company-info {
    flex: 1;
}

.fn-company-name {
    font-size: 11pt;
    font-weight: bold;
    color: #1a1a4e;
    margin-bottom: 2px;
}

.fn-company-detail {
    font-size: 9pt;
    color: #555;
    margin: 1px 0;
}

.fn-company-contact {
    text-align: right;
    font-size: 9pt;
    color: #555;
    flex-shrink: 0;
}

.fn-feenote-no {
    text-align: left;
    margin: 8px 0;
}

.fn-feenote-no .fn-label {
    font-size: 11pt;
    color: #333;
}

.fn-feenote-no .fn-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12pt;
    color: #2d2d6e;
}

.fn-date {
    text-align: left;
    font-size: 11pt;
    color: #333;
    font-style: italic;
    margin-bottom: 12px;
}

.fn-client-block {
    background: #f8f9ff;
    border-left: 3px solid #2d2d6e;
    padding: 8px 14px;
    margin: 10px 0;
    border-radius: 0 6px 6px 0;
}

.fn-client-name {
    font-weight: bold;
    font-size: 12pt;
    color: #1a1a2e;
}

.fn-client-address {
    font-size: 10pt;
    color: #555;
    margin-top: 2px;
}

.fn-client-contact-label {
    font-size: 10pt;
    color: #333;
    margin-top: 6px;
}

.fn-client-contact-name {
    font-weight: bold;
    font-size: 11pt;
}

.fn-body-text {
    font-size: 11.5pt;
    color: #333;
    margin: 12px 0;
    line-height: 1.4;
}

.fn-fee-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.fn-fee-table th,
.fn-fee-table td {
    padding: 8px 12px;
    text-align: left;
    font-size: 11pt;
}

.fn-fee-table th {
    background: #2d2d6e;
    color: white;
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fn-fee-table td {
    border-bottom: 1px solid #e5e7eb;
}

.fn-fee-table .amount {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.fn-fee-table .subtotal-row td {
    border-top: 1px solid #ccc;
    font-style: italic;
    color: #555;
}

.fn-fee-table .total-row {
    background: #f0f0ff;
    font-weight: bold;
}

.fn-fee-table .total-row td {
    border-top: 2px solid #2d2d6e;
    border-bottom: 2px solid #2d2d6e;
    font-size: 12pt;
}

.fn-notes {
    font-size: 10pt;
    color: #555;
    margin: 12px 0;
    font-style: italic;
}

.fn-bank-qr-wrapper {
    display: flex;
    gap: 20px;
    margin: 16px 0;
    align-items: flex-start;
}

.fn-bank-section {
    background: #f8f9ff;
    border: 1px solid #e5e7f0;
    border-radius: 8px;
    padding: 14px 18px;
    flex: 1;
}

.fn-qr-section {
    flex-shrink: 0;
    text-align: center;
    background: white;
    border: 1px solid #e5e7f0;
    border-radius: 8px;
    padding: 10px;
}

.fn-qr-section img {
    width: 180px;
    height: 180px;
    border-radius: 4px;
}

.fn-qr-label {
    font-size: 8pt;
    color: #666;
    margin-top: 4px;
    font-family: Arial, sans-serif;
}

.fn-bank-title {
    font-weight: bold;
    font-size: 11pt;
    color: #1a1a4e;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.fn-bank-row {
    display: flex;
    gap: 8px;
    font-size: 10pt;
    margin: 3px 0;
}

.fn-bank-label {
    color: #666;
    min-width: 140px;
    flex-shrink: 0;
}

.fn-bank-value {
    color: #1a1a2e;
    font-weight: 500;
}



/* ============================================
   History List
   ============================================ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: slideUp 0.3s ease-out;
}

.history-item:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.history-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), 60%, 0.12), hsla(var(--primary-h), var(--primary-s), 60%, 0.04));
    color: var(--primary);
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: var(--space-md);
}

.history-item-amount {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--success);
    flex-shrink: 0;
}

.history-item-delete {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
    opacity: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: hsla(0, 72%, 56%, 0.1);
    color: var(--danger);
}

/* ============================================
   Footer
   ============================================ */
.app-footer {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ============================================
   Toast / Notification
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.4s ease-out, toastOut 0.4s ease-in forwards;
    animation-delay: 0s, 2.5s;
}

.toast-success {
    border-color: var(--success);
}

.toast-success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(20px) scale(0.95); }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .app-main {
        padding: var(--space-md);
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .form-row-service {
        grid-template-columns: 1fr 36px;
    }

    .form-row-service .service-fee-group {
        grid-column: 1;
    }

    .form-section,
    .preview-section,
    .history-section {
        padding: var(--space-lg);
    }

    .feenote-preview {
        padding: 24px 20px;
        font-size: 10pt;
    }

    .fn-header {
        flex-direction: column;
        gap: 8px;
    }

    .fn-company-contact {
        text-align: left;
    }

    .fn-bank-qr-wrapper {
        flex-direction: column;
    }

    .header-inner {
        padding: var(--space-md);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-actions {
        margin-left: 0;
        width: 100%;
    }

    .preview-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        justify-content: center;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body {
        background: white !important;
    }

    .app-header,
    .form-section,
    .history-section,
    .app-footer,
    .bg-effects,
    .preview-actions,
    .section-header {
        display: none !important;
    }

    .preview-section {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .feenote-preview-wrapper {
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .feenote-preview {
        padding: 20px 30px !important;
    }

    .fn-header {
        border-bottom-color: #000 !important;
    }

    .fn-fee-table th {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .fn-fee-table .total-row {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .fn-client-block,
    .fn-bank-section {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }



    .fn-qr-section img {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================
   Animations & Utilities
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.counter-animate {
    display: inline-block;
    transition: transform var(--transition-fast);
}

.counter-animate.bump {
    transform: scale(1.08);
}
