/* Modern Soft UI - Google Loved (Responsive & Accessible) */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --focus-ring: rgba(37, 99, 235, 0.15);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header-section {
    text-align: center;
    margin-bottom: 40px;
}
.header-section h1 {
    font-size: 32px;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.subtitle {
    color: var(--text-muted);
    font-size: 16px;
}

/* Form Sections (Soft Cards) */
.form-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}
.form-section:hover {
    box-shadow: var(--shadow-md);
}
.form-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    font-weight: 600;
}
.form-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    margin-right: 12px;
    border-radius: 4px;
}

/* Grids for Layout */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.item-inputs { display: flex; flex-direction: column; gap: 12px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

/* Inputs & Form Controls (Google friendly touch targets) */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: var(--text-main);
    transition: all 0.2s ease;
    min-height: 44px; /* Mobile touch target size */
}
input:hover, select:hover, textarea:hover {
    background: var(--card-bg);
    border-color: #cbd5e1;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    background: var(--card-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}
textarea { resize: vertical; min-height: 80px; }

/* Invoice Header Area */
.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 24px;
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.invoice-number-input { display: flex; gap: 10px; }
#refreshInvoiceNumber {
    background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border-color);
    border-radius: 8px; width: 44px; font-size: 18px; cursor: pointer; transition: 0.2s;
}
#refreshInvoiceNumber:hover { background: #e2e8f0; }

/* Table Styling */
.table-responsive { overflow-x: auto; margin: 15px 0; border-radius: 8px; border: 1px solid var(--border-color); }
#itemsTable { width: 100%; min-width: 900px; border-collapse: collapse; }
#itemsTable th {
    background: #f1f5f9; padding: 14px 12px; text-align: left;
    font-size: 12px; color: var(--text-muted); text-transform: uppercase; font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}
#itemsTable td { padding: 12px; border-bottom: 1px solid var(--border-color); vertical-align: top; }
#itemsTable input { padding: 10px; min-height: 40px; }
.remove-row {
    background: #fee2e2; color: #ef4444; width: 36px; height: 36px;
    border-radius: 6px; cursor: pointer; border: none; font-weight: bold; transition: 0.2s;
}
.remove-row:hover { background: #fecaca; }

/* Totals Section */
.total-breakdown {
    background: #f8fafc; padding: 24px; border-radius: var(--radius); border: 1px solid var(--border-color);
}
.total-line {
    display: flex; justify-content: space-between; padding: 10px 0;
    color: var(--text-muted); font-size: 14px;
}
.total-line span:last-child { color: var(--text-main); font-weight: 600; }
.grand-total {
    font-size: 18px; font-weight: 800; color: var(--primary);
    border-top: 2px dashed #cbd5e1; margin-top: 12px; padding-top: 16px;
}
.grand-total span:last-child { color: var(--primary); font-size: 22px; }

/* Signature Options */
.signature-options { display: flex; gap: 15px; align-items: flex-start; flex-wrap: wrap; }
.signature-text { flex: 2; min-width: 200px; }
.signature-upload { flex: 1; min-width: 150px; }

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 24px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); width: 100%; max-width: 300px; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3); }
.btn-secondary { background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #e2e8f0; }
.actions { display: flex; justify-content: center; margin-top: 30px; margin-bottom: 40px; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .grid-2, .grid-3, .invoice-header, .summary-grid { grid-template-columns: 1fr; gap: 20px; }
    .invoice-header { padding: 15px; }
    .form-section { padding: 15px; }
    .btn-primary { max-width: 100%; }
}