/* Modern Aesthetic Design for Tambah Invoice */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --success-color: #10b981;
    --success-light: #ecfdf5;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-card: 0 4px 12px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -2px rgba(15, 23, 42, 0.03);
    --shadow-card-hover: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -3px rgba(15, 23, 42, 0.04);
}

.invoice-page-container {
    max-width: 1140px;
    margin: 1.5rem auto 3.5rem;
    padding: 0 1.25rem;
}

.back-link {
    color: var(--slate-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    padding: 6px 12px;
    border-radius: 8px;
    background-color: var(--slate-100);
    width: fit-content;
}

.back-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
    transform: translateX(-3px);
}

.page-header-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--slate-800);
    letter-spacing: -0.5px;
    margin: 0 0 0.25rem 0;
}

.page-header-subtitle {
    color: var(--slate-500);
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
}

/* Card Section */
.card-section {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-card);
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    transition: all 0.25s ease;
}

.card-section:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: #cbd5e1;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.badge-blue {
    background: #eff6ff;
    color: #2563eb;
}

.badge-emerald {
    background: #ecfdf5;
    color: #10b981;
}

.badge-purple {
    background: #f5f3ff;
    color: #8b5cf6;
}

.badge-cyan {
    background: #ecfeff;
    color: #06b6d4;
}

.toggle-pill {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--slate-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    background: var(--slate-50);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--slate-300);
    transition: all 0.2s ease;
}

.toggle-pill:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.toggle-pill input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 15px;
    height: 15px;
    cursor: pointer;
    margin: 0;
}

.toggle-pill.active-nota-pill {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
    font-weight: 700;
}

/* Forms & Grids */
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.form-group-custom {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-custom label {
    font-weight: 600;
    color: var(--slate-700);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-group-custom input, 
.form-group-custom select, 
.form-group-custom textarea {
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-size: 0.925rem;
    color: var(--slate-800);
    background-color: #ffffff;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group-custom input:focus, 
.form-group-custom select:focus, 
.form-group-custom textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.15);
    background-color: #ffffff;
}

.form-group-custom textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    color: var(--slate-500);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* Table Toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 0.85rem;
}

.item-counter-badge {
    background: var(--slate-100);
    color: var(--slate-700);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid var(--slate-200);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.quick-add-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-quick-add {
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-quick-add:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* Table Items Styling */
.table-scroll-container {
    max-height: 540px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Custom Scrollbar for smooth list view */
.table-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #f8fafc;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 680px;
}

.items-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.items-table th {
    background: #f8fafc;
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--slate-700);
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--slate-200);
    white-space: nowrap;
}

.items-table tbody tr {
    transition: background-color 0.15s ease;
}

.items-table tbody tr:hover {
    background-color: #f8fafc;
}

.items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--slate-100);
    background-color: #ffffff;
    vertical-align: middle;
}

.items-table tr:last-child td {
    border-bottom: none;
}

.row-index-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--slate-100);
    color: var(--slate-600);
    font-weight: 700;
    font-size: 0.85rem;
}

.item-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.item-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    outline: none;
}

.btn-delete-row {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid #fecaca;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.btn-delete-row:hover {
    background: var(--danger-color);
    color: #ffffff;
    border-color: var(--danger-color);
    transform: scale(1.05);
}

/* Table Bottom Controls & Summary */
.table-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 1.25rem;
}

.btn-add-row {
    padding: 0.65rem 1.25rem;
    background: #ffffff;
    color: var(--primary-color);
    border: 1.5px dashed var(--primary-color);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-add-row:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-style: solid;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.summary-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
    border: 1.5px solid var(--slate-200);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--slate-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.summary-amount {
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 800;
}

/* Preview TTD Box */
.ttd-upload-card {
    background: var(--slate-50);
    border: 1.5px dashed var(--slate-300);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    transition: border-color 0.2s ease;
}

.ttd-upload-card:hover {
    border-color: var(--primary-color);
}

.ttd-preview-thumb {
    max-height: 52px;
    max-width: 110px;
    object-fit: contain;
    background: #ffffff;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid var(--slate-200);
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--slate-200);
}

.btn-save {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-save:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-cancel {
    background: #ffffff;
    color: var(--slate-600);
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1.5px solid var(--slate-300);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel:hover {
    background: var(--slate-100);
    color: var(--slate-800);
    border-color: #94a3b8;
}

@media (max-width: 768px) {
    .invoice-page-container {
        padding: 0 0.75rem;
        margin-top: 1rem;
    }
    .card-section {
        padding: 1.25rem;
    }
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    .table-bottom-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .summary-box {
        justify-content: space-between;
    }
}
