/* Additional Component Styles */

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-in_progress {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Table action buttons */
.data-table .btn-sm {
    margin: 0 0.25rem;
}

.data-table .btn-sm:first-child {
    margin-left: 0;
}

.data-table .btn-sm:last-child {
    margin-right: 0;
}

/* Ensure action buttons are properly centered in their cells */
.data-table .table-actions {
    justify-content: center;
    min-height: 40px;
}

/* Consistent spacing for action buttons across all tables */
.data-table td.table-actions {
    padding: 0.5rem;
    vertical-align: middle;
}

/* Ensure all action buttons in tables are properly aligned */
.data-table .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 32px;
    margin: 0 0.25rem;
}

/* Icon-only compact buttons for mobile-friendly tables */
.btn-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; fill: currentColor; }
.data-table .btn-icon { min-width: 34px !important; height: 34px !important; }

/* History page compact layout */
#historyPage .data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* enables predictable column widths + ellipsis */
}
#historyPage .data-table th,
#historyPage .data-table td {
    padding: 6px 8px;
    font-size: 13px;
}
#historyPage {
    font-size: 14px;
}
#historyPage .data-table td:first-child,
#historyPage .data-table th:first-child {
    width: 110px; /* Date */
}
#historyPage .data-table td:last-child,
#historyPage .data-table th:last-child {
    width: 84px; /* two icon buttons */
    white-space: nowrap;
    padding-right: 6px;
}
#historyPage .data-table .table-actions {
    justify-content: flex-start;
    gap: 6px;
    min-height: 0;
}

/* Single-line ellipsis for client name */
#historyPage .data-table td.client-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#historyPage .data-table td.table-actions { padding-left: 4px; padding-right: 4px; }

/* Specific alignment for Users and PCOs tables */
#usersPage .data-table .table-actions,
#pcosPage .data-table .table-actions {
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* PDF Generation Button States */
.btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #6c757d !important;
    color: white !important;
}

.btn-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.btn-warning {
    background-color: #ff9800 !important; /* bright orange */
    border-color: #ff9800 !important;
    color: #ffffff !important;
}

/* Explicit yellow button variant for emphasis */
.btn-yellow {
    background-color: #ffeb3b !important; /* yellow */
    border-color: #ffeb3b !important;
    color: #111 !important;
}

.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

/* Ensure consistent button spacing across all table types */
.data-table .table-actions .btn:first-child {
    margin-left: 0;
}

.data-table .table-actions .btn:last-child {
    margin-right: 0;
}

/* Final alignment fix for all action columns */
/* Removed global last-child alignment to avoid forcing spacing app-wide */

/* Ensure all action buttons are properly sized and spaced */
.data-table .table-actions .btn-sm {
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.btn-icon {
    padding: 0.5rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Layouts */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

@media (max-width: 768px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #95a5a6;
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: #7f8c8d;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Table Enhancements */
.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.table-status {
    text-align: center;
}

.table-actions-cell {
    width: 120px;
    text-align: center;
}

/* Ensure Actions column header is centered */
.data-table th:last-child,
.data-table th.actions-header {
    text-align: center;
}

/* Ensure all Actions columns are properly aligned */
.data-table th.actions-header,
.data-table td:last-child {
    text-align: center;
}

/* Consistent action button alignment across all tables */
.data-table .table-actions {
    justify-content: center;
    align-items: center;
    min-height: 40px;
    /* width removed to avoid stretching action cells globally */
}

/* Ensure action cells have consistent alignment */
/* Removed global enforcement of action cell alignment; scoped under #historyPage elsewhere */

/* Inline editable reference in Audit Log: match cell typography */
.data-table .audit-ref-input {
    width: 100%;
    font: inherit; /* font-family, size, weight from table */
    line-height: inherit;
    color: inherit;
    background: transparent;
    border: none;
    padding: 0;
}

.data-table .audit-ref-input:focus {
    outline: 1px dashed #999;
    outline-offset: 2px;
}

/* Audit Log: ensure Reference column has enough room and does not clip */
#auditPage .data-table th:nth-child(5),
#auditPage .data-table td:nth-child(5) {
    /* Let Reference take more space while keeping other columns compact */
    width: 40%;
}

#auditPage .data-table td:nth-child(5) {
    /* Allow wrapping so long references are fully visible */
    white-space: normal;
    word-break: break-word;
}

#auditPage .audit-ref-input {
    /* Inputs are single-line; give them breathing room so text isn’t visually cut */
    min-width: 420px;
}

@media (max-width: 900px) {
    #auditPage .audit-ref-input { min-width: 300px; }
}

/* Search Enhancements */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button:hover {
    background-color: #f8f9fa;
}

.pagination button.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

/* Circular blue help icon variant */
.tooltip.tooltip-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #3498db;
    color: #3498db;
    font-weight: 700;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Card Variations */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.card-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

/* Dashboard Items */
.dashboard-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.dashboard-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.item-date {
    font-size: 0.875rem;
    color: #7f8c8d;
}

.item-stock {
    font-size: 0.875rem;
    color: #7f8c8d;
    font-weight: 500;
}

.item-details {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #95a5a6;
}

.stock-status {
    color: #e67e22;
    font-weight: 500;
}

.technician, .pest, .contact {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Stock Summary */
.stock-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 500;
    color: #2c3e50;
}

.summary-value {
    font-weight: 600;
    color: #27ae60;
}

.summary-value.warning {
    color: #e67e22;
}

/* Stock Alerts */
.stock-alert {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.stock-alert:last-child {
    border-bottom: none;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.alert-stock {
    font-weight: 600;
    color: #e74c3c;
}

.alert-details {
    font-size: 0.875rem;
    color: #95a5a6;
}

.min-stock {
    background: #fff3cd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #856404;
}

/* Upcoming Services */
.upcoming-service {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.upcoming-service:last-child {
    border-bottom: none;
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.service-date {
    font-size: 0.875rem;
    color: #7f8c8d;
}

.service-details {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #95a5a6;
}

/* Products List in Service Details */
.products-list {
    margin-top: 10px;
}

.product-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.product-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 16px;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
}

.product-details .quantity {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.product-details .areas {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Form Help Text */
.form-help {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Dashboard Stock + Movement Summary */
.stock-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    background: #f9fbfd;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.stock-summary .summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 6px;
    padding: 10px 12px;
}

/* Make valuation span full width under the 3-column grid */
.stock-summary .valuation-item {
    grid-column: 1 / -1;
}

.summary-label {
    color: #6b7280; /* muted gray */
    font-size: 0.9rem;
}

.summary-value {
    font-weight: 700;
    color: #111827;
}

.movement-summary {
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 12px;
}

.movement-summary .movement-header {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.movement-summary .movement-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.movement-summary .movement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
}

.movement-summary .movement-item .label {
    color: #6b7280;
    font-size: 0.9rem;
}

.movement-summary .movement-item .value {
    font-weight: 700;
    color: #111827;
}

@media (max-width: 900px) {
    .stock-summary { grid-template-columns: 1fr; }
    .movement-summary .movement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .movement-summary .movement-grid { grid-template-columns: 1fr; }
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Detail Sections */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Service Details Modal Optimization */
.service-details-modal .modal-body {
    padding: 2rem;
}

.service-details-modal .detail-section {
    margin-bottom: 2rem;
}

.service-details-modal .detail-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.service-details-modal .detail-row:last-child {
    border-bottom: none;
}

.service-details-modal .detail-row strong {
    min-width: 180px;
    color: #2c3e50;
    font-weight: 600;
}

/* Ensure modal content fits well in larger modal */
.service-details-modal .modal-body {
    max-height: calc(95vh - 120px); /* Account for header and padding */
    overflow-y: auto;
}

.service-details-modal .service-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.service-details-modal .products-list {
    margin-top: 15px;
}

.service-details-modal .product-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.service-details-modal .product-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    font-size: 18px;
}

.service-details-modal .product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 15px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    color: #2c3e50;
    min-width: 150px;
}

/* Low Stock Highlighting */
.low-stock {
    color: #e74c3c;
    font-weight: 600;
}

/* Positive/Negative Changes */
.positive-change {
    color: #27ae60;
    font-weight: 600;
}

.negative-change {
    color: #e74c3c;
    font-weight: 600;
}

/* Enhanced stock level indicators */
.stock-level-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.stock-level-label {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 500;
}

.stock-critical {
    background-color: #dc3545;
    color: #fff;
}

.stock-critical .stock-level-indicator {
    background-color: #dc3545;
}

.stock-critical .stock-level-label {
    background-color: #dc3545;
    color: #fff;
}

.low-stock .stock-level-indicator {
    background-color: #d63384;
}

.low-stock .stock-level-label {
    background-color: #d63384;
    color: #fff;
}

.stock-warning .stock-level-indicator {
    background-color: #fd7e14;
}

.stock-warning .stock-level-label {
    background-color: #fd7e14;
    color: #fff;
}

.stock-normal .stock-level-indicator {
    background-color: #198754;
}

.stock-normal .stock-level-label {
    background-color: #198754;
    color: #fff;
}

/* Dashboard stock alerts with levels */
.stock-alert.stock-critical {
    border-left: 4px solid #dc3545;
    background-color: #f8d7da;
}

.stock-alert.low-stock {
    border-left: 4px solid #d63384;
    background-color: #f8d7da;
}

.stock-alert.stock-warning {
    border-left: 4px solid #fd7e14;
    background-color: #fff3cd;
}

.stock-level-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard summary values */
.summary-value.critical {
    color: #dc3545;
    font-weight: 600;
}

.summary-value.warning {
    color: #fd7e14;
    font-weight: 600;
}

/* Session Warning */
.session-warning {
    text-align: center;
}

.session-warning p {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.session-warning-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Date Range Filter Styling */
.date-range-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.date-range-filter label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
}

.date-range-filter input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 140px;
}

.date-range-filter input[type="date"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Responsive adjustments for date range filter */
@media (max-width: 768px) {
    .date-range-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }
    
    .date-range-filter input[type="date"] {
        min-width: auto;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.hidden { display: none; }
.visible { display: block; }

.pointer { cursor: pointer; }
.no-select { user-select: none; }

/* Print Styles */
@media print {
    .navbar,
    .search-bar,
    .action-buttons,
    .modal-overlay {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .page {
        display: block !important;
    }
}

/* Inactive inventory rows */
.inactive-row {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.inactive-row:hover {
    opacity: 0.8;
    background-color: #e9ecef;
}

/* Status filter dropdown */
.status-filter {
    margin-left: 10px;
}

.status-filter select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Role and PCO Badges */
.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background-color: #dc3545;
    color: white;
}

.role-user {
    background-color: #6c757d;
    color: white;
}

.role-client {
    background-color: #17a2b8;
    color: white;
}

.pco-badge {
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* User Details Modal */
.user-details {
    margin-bottom: 20px;
}

.user-details .detail-row {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.user-details .detail-row:last-child {
    border-bottom: none;
}

.user-details .detail-row strong {
    color: #333;
    min-width: 140px;
}

/* ========================================
   SERVICE FORM COMPONENTS
   ======================================== */

/* Service Form Container */
.service-form-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

/* Ensure the service form page has a clean white background */
#serviceFormPage {
    background: #ffffff !important;
    min-height: 100vh;
}

#serviceFormPage .page-content {
    background: #ffffff !important;
}

/* Override any inherited background colors */
#serviceFormPage,
#serviceFormPage * {
    background-color: #ffffff !important;
}

/* Specific overrides for form elements */
#serviceFormPage input,
#serviceFormPage select,
#serviceFormPage textarea,
#serviceFormPage .form-group,
#serviceFormPage .form-section {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Business Name field styling */
#serviceFormPage #businessNameDisplay {
    background-color: #fff3cd !important;
    color: #000000 !important;
    font-weight: 500;
    border: 1px solid #ffeaa7;
    cursor: default;
    opacity: 1;
}

#serviceFormPage #businessNameDisplay:focus {
    background-color: #fff3cd !important;
    color: #000000 !important;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Business Name field label styling */
#serviceFormPage label[for="businessNameDisplay"] {
    color: #000000 !important;
    font-weight: 600;
}

/* Service Form Button Styling */
.service-form-container .form-buttons {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.service-form-container .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    /* Override any inherited background and color */
    background-color: initial !important;
    color: initial !important;
}

/* Ensure custom button variants show inside service form container */
.service-form-container .btn-yellow {
    background-color: #ffeb3b !important; /* bright yellow */
    color: #111 !important;
    border: 2px solid #ffeb3b !important;
}
.service-form-container .btn-yellow:hover {
    background-color: #fdd835 !important; /* slightly darker yellow */
    border-color: #fdd835 !important;
}

.service-form-container .btn-warning {
    background-color: #ffeb3b !important; /* force yellow in form */
    color: #111 !important;
    border: 2px solid #ffeb3b !important;
}
.service-form-container .btn-warning:hover {
    background-color: #fdd835 !important;
    border-color: #fdd835 !important;
}

.service-form-container .btn-primary {
    background-color: #007bff !important;
    color: #ffffff !important;
    border: 2px solid #007bff;
}

.service-form-container .btn-primary:hover {
    background-color: #0056b3 !important;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.service-form-container .btn-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border: 2px solid #6c757d;
}

.service-form-container .btn-secondary:hover {
    background-color: #545b62 !important;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.service-form-container .btn-danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border: 2px solid #dc3545;
}

.service-form-container .btn-danger:hover {
    background-color: #c82333 !important;
    border-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.service-form-container .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile responsive button layout */
@media (max-width: 768px) {
    .service-form-container .form-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .service-form-container .form-buttons .btn {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Force button colors with higher specificity */
#serviceFormPage .btn-primary,
#serviceFormPage button.btn-primary,
#serviceFormPage input[type="submit"].btn-primary {
    background-color: #007bff !important;
    color: #ffffff !important;
    border: 2px solid #007bff !important;
}

#serviceFormPage .btn-secondary,
#serviceFormPage button.btn-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border: 2px solid #6c757d !important;
}

#serviceFormPage .btn-danger,
#serviceFormPage button.btn-danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border: 2px solid #dc3545 !important;
}

/* Compact delete buttons for products summary (icon-only) */
#serviceFormPage .summary-delete-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 18px;
}

@media (max-width: 768px) {
    #serviceFormPage .summary-delete-btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Ensure placeholder text is also visible */
#serviceFormPage input::placeholder,
#serviceFormPage textarea::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

/* Form field error states */
.service-form-container input.error,
.service-form-container select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.service-form-container input.error:focus,
.service-form-container select.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Ensure form fields have clean white backgrounds */
.service-form-container input,
.service-form-container select,
.service-form-container textarea {
    background-color: #ffffff !important;
    border: 1px solid #ced4da;
    color: #000000 !important;
}

.service-form-container input:focus,
.service-form-container select:focus,
.service-form-container textarea:focus {
    background-color: #ffffff !important;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    color: #000000 !important;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 10px;
    position: relative;
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background: white;
    padding: 0 10px;
    min-width: 80px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
    line-height: 1.2;
}

.step.active .step-number {
    background: #007bff;
    color: white;
}

.step.active .step-label {
    color: #007bff;
    font-weight: 600;
}

.step.completed .step-number {
    background: #28a745;
    color: white;
}

.step.completed .step-label {
    color: #28a745;
}

.step.completed .step-number::after {
    content: '✓';
    font-weight: bold;
}

/* Form Header */
.form-header {
    margin-bottom: 30px;
    text-align: center;
}

.form-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 600;
}

/* Form Messages and Errors */
.form-messages,
.form-errors {
    margin-bottom: 20px;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-messages {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 16px;
    border-radius: 6px;
}

.error-messages h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.error-messages ul {
    margin: 0;
    padding-left: 20px;
}

.error-messages li {
    margin-bottom: 4px;
}

/* Service Form */
.service-form {
    position: relative;
}

.form-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.form-step.active {
    display: block;
}

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

.form-section {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Edit Service modal: highlight Products Used (Edit) section */
.products-used-edit-section {
    background-color: #fff3cd !important; /* light yellow */
    border-color: #ffe8a1 !important;
}

.form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-label.required::after {
    content: ' *';
    color: #dc3545;
    font-weight: bold;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-input::placeholder {
    color: #6c757d;
    opacity: 1;
}

/* Business Name Display */
.business-name-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 16px;
    color: #495057;
    font-weight: 500;
    min-height: 50px;
    display: flex;
    align-items: center;
}

/* PCO Selection */
.pco-selection {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 12px;
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.pco-option {
    margin-bottom: 8px;
}

.pco-option:last-child {
    margin-bottom: 0;
}

.pco-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: relative;
    padding-left: 32px;
}

.pco-checkbox:hover {
    background-color: #f8f9fa;
}

.pco-checkbox input[type="checkbox"] {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    margin: 0;
}

.pco-reg {
    color: #6c757d;
    font-size: 12px;
    margin-left: 4px;
}

.loading-pcos {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Step Placeholders */
.step-placeholder {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
}

/* Form Navigation */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-top: 1px solid #e9ecef;
    margin-top: 30px;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

.form-navigation .btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745 !important;
    color: #ffffff !important;
    border-color: #28a745 !important;
}

.btn-success:hover {
    background: #1e7e34 !important;
    border-color: #1e7e34 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 2px solid #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    color: #6c757d;
    margin: 0;
    font-weight: 500;
}

/* ========================================
   MOBILE RESPONSIVE DESIGN
   ======================================== */

/* Mobile First - Base styles are for mobile */
@media (max-width: 767px) {
    .service-form-container {
        padding: 16px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .step-indicator {
        margin-bottom: 20px;
        padding: 0 5px;
    }

    .step {
        min-width: 60px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
        margin-bottom: 4px;
    }

    .step-label {
        font-size: 10px;
        line-height: 1.1;
    }

    .form-header h2 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .form-section {
        padding: 16px;
        margin: 0 -4px;
    }

    .form-section h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-input,
    .form-select {
        padding: 14px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .business-name-display {
        padding: 14px 12px;
        min-height: 46px;
        font-size: 16px;
    }

    .pco-selection {
        max-height: 150px;
        padding: 8px;
    }

    .pco-checkbox {
        padding: 6px;
        padding-left: 28px;
    }

    .pco-checkbox input[type="checkbox"] {
        width: 14px;
        height: 14px;
        left: 6px;
    }

    .form-navigation {
        padding: 12px 16px;
        margin-top: 20px;
        flex-direction: column;
        gap: 12px;
        /* Keep actions visible at bottom on mobile */
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #e9ecef;
        z-index: 10;
    }

    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .form-navigation .btn {
        padding: 14px 20px;
        font-size: 16px;
        min-width: 100px;
        flex: 1;
    }

    .loading-indicator {
        padding: 20px;
    }

    .spinner {
        width: 32px;
        height: 32px;
        margin-bottom: 12px;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1023px) {
    .service-form-container {
        max-width: 700px;
        padding: 24px;
        margin: 20px auto;
    }

    .step-indicator {
        padding: 0 20px;
    }

    .form-section {
        padding: 20px;
    }

    .form-navigation .btn {
        min-width: 140px;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .service-form-container {
        max-width: 800px;
        padding: 32px;
        margin: 30px auto;
    }

    .step-indicator {
        padding: 0 40px;
        margin-bottom: 40px;
    }

    .step {
        min-width: 120px;
    }

    .form-section {
        padding: 28px;
    }

    .form-header h2 {
        font-size: 28px;
    }

    .form-section h3 {
        font-size: 22px;
    }

    .form-navigation {
        padding: 32px 0;
        margin-top: 40px;
    }

    .form-navigation .btn {
        min-width: 160px;
        padding: 14px 28px;
    }

    /* Two-column layout for larger screens */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .form-row .form-group {
        margin-bottom: 20px;
    }

    /* Full width for certain fields */
    .form-group.full-width {
        grid-column: 1 / -1;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .step-indicator::before {
        height: 1px;
    }
}

/* Print Styles */
@media print {
    .service-form-container {
        box-shadow: none;
        padding: 0;
    }

    .form-navigation,
    .loading-indicator {
        display: none;
    }

    .step-indicator {
        margin-bottom: 20px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .form-step,
    .spinner,
    .btn {
        animation: none;
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .service-form-container {
        background: #343a40;
        color: #f8f9fa;
    }

    .form-section {
        background: #495057;
        border-color: #6c757d;
    }

    .form-input,
    .form-select,
    .business-name-display,
    .pco-selection {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .form-input::placeholder {
        color: #adb5bd;
    }

    .step-indicator::before {
        background: #6c757d;
    }
}

/* Pest Selection Styles */
.pest-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.pest-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pest-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    user-select: none;
    gap: 12px;
    min-height: 50px;
}

.pest-checkbox:hover {
    background-color: #f8f9fa;
}

.pest-checkbox input[type="checkbox"] {
    display: none;
}

.pest-checkbox .checkbox-indicator {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #6c757d;
    min-width: 40px;
    transition: color 0.2s ease;
}

.pest-checkbox input[type="checkbox"]:checked + .checkbox-indicator {
    color: #007bff;
}

.pest-checkbox .pest-label {
    font-size: 0.95rem;
    color: #333;
    flex: 1;
}

/* Error state for pest selection */
.pest-selection-grid.error {
    border: 2px solid #dc3545;
    border-radius: 6px;
    padding: 0.5rem;
}

.pest-selection-grid.error .pest-checkbox .checkmark {
    border-color: #dc3545;
}

/* Success state for pest selection */
.pest-selection-grid.success .pest-checkbox .checkmark {
    border-color: #28a745;
}

/* Other pest input field */
.other-pest-input {
    margin-top: 0.5rem;
    margin-left: 2rem;
    animation: slideDown 0.3s ease-out;
}

.other-pest-input .form-input {
    width: 100%;
    max-width: 300px;
    font-size: 0.9rem;
    padding: 0.5rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Product Selection Styles - Simple Approach */
.product-selection-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.product-item {
    cursor: pointer;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    min-height: 44px;
}

.product-item:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.product-checkbox-simple {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
}

.checkbox-indicator {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #007bff;
    min-width: 32px;
}

.product-label {
    font-size: 0.95rem;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-item.selected {
    border-color: #ffc107;
    background-color: #fff8e1;
}

.product-item.selected .product-label {
    font-weight: 600;
    color: #856404;
}

/* Application Areas Styles */
.application-areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.area-item {
    cursor: pointer;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    min-height: 50px;
}

.area-item:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.area-checkbox-simple {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.area-item.selected {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.area-item.selected .area-label {
    font-weight: 600;
    color: #007bff;
}

.area-label {
    font-size: 0.95rem;
    color: #333;
    flex: 1;
}

/* Quantity Input Styles */
.quantity-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 0.5rem;
}

.quantity-input {
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    min-width: 150px;
    transition: border-color 0.2s ease;
}

/* Search and Chips */
.product-search-bar {
    margin-top: 0.25rem;
}
.product-search-bar .search-input {
    width: 100%;
}
.chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.chips-row#selectedProductsChips .chip,
#selectedProductsChips .chip {
    background-color: #fff8e1;
    border-color: #ffc107;
    color: #856404;
}
#selectedProductsChips .chip .chip-remove {
    color: #856404;
}
#selectedProductsChips .chip .chip-remove:hover {
    color: #dc3545;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: #f1f3f5;
    color: #212529;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
}
.chip .chip-remove {
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.chip .chip-remove:hover {
    color: #dc3545;
}

/* Suggestions */
.suggestions-section {
    margin-top: 10px;
}
.suggestion-group {
    margin-bottom: 8px;
}
.suggestion-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 6px;
}
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip.suggestion {
    cursor: pointer;
}
.chip.suggestion:hover {
    background-color: #e9ecef;
}

/* Favorite toggle on product list */
.favorite-toggle {
    background: transparent;
    border: none;
    color: #ffc107;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.product-checkbox-simple .favorite-toggle {
    margin-left: 6px;
}

.quantity-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.quantity-unit {
    font-size: 0.95rem;
    color: #6c757d;
    font-weight: 500;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
}

/* Mobile styles */
@media (max-width: 768px) {
    .product-selection-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .product-checkbox-simple {
        padding: 16px;
    }
    
    .application-areas-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .quantity-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .quantity-input,
    .quantity-unit {
        width: 100%;
        min-width: auto;
    }
}

/* Radio Button Styles */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-group.horizontal {
    flex-direction: row;
    align-items: center;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    min-width: 100px;
}

.radio-option:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    background-color: #ffffff;
    font-size: 0.8rem;
    font-weight: bold;
    color: #6c757d;
    transition: all 0.2s ease;
}

.radio-text {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
}

.radio-option input[type="radio"]:checked + .radio-indicator {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

.radio-option input[type="radio"]:checked ~ .radio-text {
    color: #007bff;
    font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
    background-color: #e3f2fd;
    border-color: #007bff;
}

/* Form Input and Textarea Styles */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background-color: #ffffff;
}

.form-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
    background-color: #ffffff;
}

.form-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-textarea::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Service Form Submit Button - Ensure Green Color */
#serviceFormPage .btn-success,
.service-form-container .btn-success {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border-color: #28a745 !important;
}

#serviceFormPage .btn-success:hover,
.service-form-container .btn-success:hover {
    background-color: #1e7e34 !important;
    border-color: #1e7e34 !important;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* Mobile responsive for radio buttons */
@media (max-width: 768px) {
    .radio-group.horizontal {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .radio-option {
        justify-content: center;
        min-width: auto;
        padding: 1rem;
    }
}



/* Loading message */
.loading-message {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Error state for product selection */
.product-selection-grid.error {
    border: 2px solid #dc3545;
    border-radius: 6px;
    padding: 0.5rem;
}

.product-selection-grid.error .product-checkbox .checkmark {
    border-color: #dc3545;
}

/* Success state for product selection */
.product-selection-grid.success .product-checkbox .checkmark {
    border-color: #28a745;
}

/* Mobile responsive for product selection */
@media (max-width: 768px) {
    .product-selection-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .product-checkbox {
        padding: 1rem;
        min-width: auto;
    }
}

/* Mobile responsive for pest selection */
@media (max-width: 768px) {
    .pest-selection-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .pest-column {
        gap: 0.5rem;
    }
    
    .pest-checkbox {
        padding: 0.75rem;
    }
    
    .pest-checkbox .checkbox-indicator {
        min-width: 40px;
        margin-right: 1rem;
    }
}
/* Inventory page filter layout */
.inventory-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.inventory-controls .status-filter,
.inventory-controls .location-filter {
    display: inline-flex;
    align-items: center;
}

#statusFilter,
#locationFilter {
    width: 220px;
    min-width: 220px;
    height: 36px;
}

@media (max-width: 768px) {
    #statusFilter,
    #locationFilter {
        width: 100%;
        min-width: 0;
    }
}
/* Dashboard filters */
.dashboard-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Right-align Inventory header buttons */
.inventory-controls .button-group {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
 



/* Technician History strong overrides (mobile fit) */
#historyPage .data-table {
    width: 100vw !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}
#historyPage .data-table th,
#historyPage .data-table td {
    padding: 4px !important;
    font-size: 12px !important;
}
#historyPage .data-table td:first-child,
#historyPage .data-table th:first-child {
    width: 74px !important; /* Date */
}
#historyPage .data-table td:last-child,
#historyPage .data-table th:last-child {
    width: 60px !important; /* two 28px icons + gap */
    white-space: nowrap !important;
    padding-right: 4px !important;
    text-align: right !important;
}
#historyPage .data-table td.client-cell {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
#historyPage .data-table .table-actions {
    width: auto !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 4px !important;
}
#historyPage .btn-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 4px !important;
}

/* History client cell alignment to reduce perceived gap */
#historyPage .data-table td.client-cell {
  text-align: right !important;
  padding-right: 4px !important;
}
#historyPage .btn-icon { width: 24px !important; height: 24px !important; min-width: 24px !important; padding: 3px !important; }
#historyPage .data-table td:last-child, #historyPage .data-table th:last-child { width: 52px !important; }
/* History client cell left align to reduce date gap */
#historyPage .data-table td.client-cell {
  text-align: left !important;
  padding-left: 4px !important;
}
/* Final History table width + spacing overrides */
#historyPage .data-table { width: auto !important; display: inline-table !important; }
#historyPage .data-table th, #historyPage .data-table td { padding: 4px !important; font-size: 12px !important; }
#historyPage .data-table th:first-child, #historyPage .data-table td:first-child { width: 80px !important; }
#historyPage .data-table th:last-child, #historyPage .data-table td:last-child { width: 52px !important; white-space: nowrap !important; padding-right: 4px !important; }
#historyPage .data-table td.client-cell { text-align: left !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
#historyPage .btn-icon { width: 24px !important; height: 24px !important; min-width: 24px !important; padding: 3px !important; }
#historyPage .data-table .table-actions { gap: 4px !important; justify-content: flex-start !important; }

/* Force Client column left-align even if class missing */
#historyPage .data-table td:nth-child(2),
#historyPage .data-table th:nth-child(2) {
  text-align: left !important;
  padding-left: 4px !important;
}

/* Shrink Actions header text influence */
#historyPage .data-table th.actions-header {
  width: 52px !important;
  white-space: nowrap !important;
  font-size: 0 !important; /* hide word to not push width */
}
#historyPage .data-table th.actions-header::after {
  content: '';
}
/* Override generic table min-width and scrolling for History page */
#historyPage .table-container { overflow-x: hidden !important; }
#historyPage .data-table { min-width: 0 !important; width: 100% !important; }
/* History ultra-compact tune for 360px width */
#historyPage .data-table th, #historyPage .data-table td { padding: 2px 2px !important; font-size: 12px !important; }
#historyPage .data-table th:first-child, #historyPage .data-table td:first-child { width: 68px !important; }
#historyPage .btn-icon { width: 22px !important; height: 22px !important; min-width: 22px !important; padding: 2px !important; }
#historyPage .data-table th:last-child, #historyPage .data-table td:last-child { width: 48px !important; padding-right: 2px !important; }
#historyPage .data-table .table-actions { gap: 2px !important; justify-content: flex-start !important; }
/* Extra-tight History variant (20px icons + 44px actions) */
#historyPage .btn-icon { width: 20px !important; height: 20px !important; min-width: 20px !important; padding: 1px !important; }
#historyPage .data-table th:last-child, #historyPage .data-table td:last-child { width: 44px !important; padding-right: 1px !important; }
#historyPage .data-table th:first-child, #historyPage .data-table td:first-child { width: 62px !important; }
#historyPage .data-table th, #historyPage .data-table td { padding: 2px 2px !important; font-size: 11px !important; }
/* History: enforce fixed client width with ellipsis */
#historyPage .data-table col.client-col { width: 200px !important; }
#historyPage .data-table td.client-cell { width: 200px !important; max-width: 200px !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
/* History: lock client/actions sizes and hide Actions header text */
#historyPage .data-table col.client-col { width: 180px !important; }
#historyPage .data-table th.actions-header { font-size: 0 !important; width: 56px !important; }
#historyPage .data-table th.actions-header::after { content: '';
}
#historyPage .data-table td.client-cell { width: 180px !important; max-width: 180px !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
#historyPage .data-table th:last-child, #historyPage .data-table td:last-child { width: 56px !important; }
#historyPage .btn-icon { width: 24px !important; height: 24px !important; min-width: 24px !important; padding: 2px !important; }

/* Negative stock highlight */
.stock-negative { color: #d32f2f; font-weight: 600; }

