/* Inline action and report button groups for raw materials table */
.action-groups-inline {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.action-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}
.action-group-inline .group-label {
    font-weight: 500;
    margin-right: 0.5rem;
    color: var(--text-secondary);
    min-width: 60px;
}
/* ANKITA PAINTS AND POLYMERS - Complete Stylesheet */
/* Built from scratch with purple theme and professional styling */

:root {
    --primary-color: #6B3F69;
    --secondary-color: #3E1E68;
    --background-color: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --text-muted: #A0AEC0;
    --border-color: #E2E8F0;
    --success-color: #48BB78;
    --warning-color: #ED8936;
    --error-color: #F56565;
    --info-color: #4299E1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F7FAFC;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Authentication Page Styles */
.auth-page {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.company-header {
    text-align: center;
    margin-bottom: 2rem;
}

.company-header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.company-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-form {
    margin-bottom: 1rem;
}

.auth-form.hidden {
    display: none;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.auth-switch {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Navigation Styles */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 64px;
}

.nav-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    height: 64px;
    display: flex;
    align-items: center;
}


.nav-link:hover {
    color: var(--primary-color);
    background-color: #F7FAFC;
    border-bottom-color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #F7FAFC;
}

.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 1rem 1.5rem;
    font-size: inherit;
    color: var(--text-secondary);
    font-weight: 500;
    height: 64px;
}

.dropdown-toggle:hover {
    color: var(--primary-color);
    background-color: #F7FAFC;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1001;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-menu a:hover {
    background-color: #F7FAFC;
    color: var(--primary-color);
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}


/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 64px);
}

/* Page Container */
.page-container {
    max-width: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header .actions {
    display: flex;
    gap: 0.75rem;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 63, 105, 0.1);
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    min-width: 150px;
}


/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start; /* Align items to top */
}


.form-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-height: 80px; /* Reserve space for error messages */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align content to top */
}

.form-row .form-group .error-message {
    margin-top: 5px;
    font-size: 0.75rem;
    line-height: 1.2;
    min-height: 1.2rem; /* Reserve space even when hidden */
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    color: #dc3545;
}

.form-row .form-group .error-message.show {
    visibility: visible;
    opacity: 1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    min-height: 1.2rem; /* Ensure consistent label height */
    line-height: 1.2;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: white;
    height: 2.75rem; /* Explicit height for consistency */
    box-sizing: border-box; /* Include padding in height calculation */
}

.form-control.contact-digits-invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 0.2rem rgba(245, 101, 101, 0.25);
}

.contact-digit-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.contact-digit-feedback.success {
    color: var(--success-color);
}

.contact-digit-feedback.error {
    color: var(--error-color);
}

.password-input-wrapper {
    position: relative;
}

.password-toggle-button {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    cursor: pointer;
}

.password-toggle-button:focus {
    outline: none;
    text-decoration: underline;
}

.password-toggle-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.password-toggle-slash {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.password-toggle-icon .password-toggle-eye {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.password-toggle-button.is-visible .password-toggle-slash {
    opacity: 0;
}

.password-toggle-eyebrow {
    opacity: 0.8;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 63, 105, 0.1);
}

.contact-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    flex-wrap: nowrap;
}

.contact-input-group select {
    width: 140px;
    flex-shrink: 0;
}

.contact-input-group input {
    flex: 1;
    min-width: 0;
}

.field-hint {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contact-input-group {
    flex-wrap: nowrap;
}

/* Modern Dropdown Styling */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B3F69' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

select.form-control:hover {
    border-color: #9B7A99;
    background-color: #FAFAFA;
}

select.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 63, 105, 0.1);
    background-color: white;
}

select.form-control:disabled {
    background-color: #F7FAFC;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Dropdown Options */
select.form-control option {
    padding: 0.5rem;
    font-weight: 400;
    border-radius: 4px;
}

select.form-control option:checked {
    background-color: var(--primary-color);
    color: white;
}

/* Rounded dropdown menu corners */
select.form-control::-webkit-scrollbar {
    width: 8px;
}

select.form-control::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

select.form-control::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

select.form-control::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
    border-color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.btn-danger:hover:not(:disabled) {
    background-color: #E53E3E;
    border-color: #E53E3E;
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-success:hover:not(:disabled) {
    background-color: #38A169;
    border-color: #38A169;
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.btn-warning:hover:not(:disabled) {
    background-color: #DD6B20;
    border-color: #DD6B20;
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
    border-color: var(--info-color);
}

.btn-info:hover:not(:disabled) {
    background-color: #3182CE;
    border-color: #3182CE;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #F0FFF4;
    border-color: var(--success-color);
    color: #22543D;
}

.alert-error {
    background-color: #FED7D7;
    border-color: var(--error-color);
    color: #742A2A;
}

.alert-warning {
    background-color: #FFFAF0;
    border-color: var(--warning-color);
    color: #744210;
}

.alert-info {
    background-color: #EBF8FF;
    border-color: var(--info-color);
    color: #2A4365;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.table-container.materials-table-responsive {
    overflow-x: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: auto;
}

.data-table th {
    background: #F7FAFC;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem;
    border-bottom: 2px solid #d1d5db; /* Thicker, more visible separator */
    vertical-align: middle;
}

.data-table tr:hover {
    background-color: #F8FAFC;
}

/* Remove border from last row for cleaner look */
.data-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 1024px) {
    .materials-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .materials-table-responsive .data-table {
        min-width: 900px;
    }
}

/* Utility alignment helpers */
.text-right {
    text-align: right;
}

.data-table .actions {
    white-space: nowrap;
    min-width: 280px;
    text-align: center;
}

.data-table .actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.data-table .actions .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    height: 34px;
    line-height: 1.2;
}

/* Consistent Button Sizing for Actions and Reports */
.action-btn,
.report-btn {
    min-width: 110px;
    text-align: center;
    display: inline-block;
}

/* Action Groups */
.action-groups {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.group-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-right: 0.25rem;
    white-space: nowrap;
}

/* Status and Stock Classes */
.in-stock {
    background-color: #fff !important;
}

.low-stock {
    background-color: #FFFAF0 !important;
}

.out-of-stock {
    background-color: #FED7D7 !important;
}

.text-success {
    color: var(--success-color) !important;
    font-weight: 500;
}

.text-warning {
    color: var(--warning-color) !important;
    font-weight: 500;
}

.text-danger {
    color: var(--error-color) !important;
    font-weight: 500;
}

.text-info {
    color: var(--info-color) !important;
    font-weight: 500;
}

.text-muted {
    color: var(--text-muted);
}

small.text-muted {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.text-center {
    text-align: center;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-success {
    background-color: var(--success-color);
    color: white;
}

.status-warning {
    background-color: var(--warning-color);
    color: white;
}

.status-danger {
    background-color: var(--error-color);
    color: white;
}

.status-info {
    background-color: var(--info-color);
    color: white;
}

/* Sales Order Status Badges */
.status-delivered {
    background-color: var(--success-color);
    color: white;
}

.status-confirmed {
    background-color: var(--info-color);
    color: white;
}

.status-pending {
    background-color: var(--warning-color);
    color: white;
}

.status-cancelled {
    background-color: var(--error-color);
    color: white;
}

/* Badge Count for Items */
.badge-count {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}


/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

.modal-large {
    max-width: 900px;
    width: 90%;
}

.modal-xlarge {
    max-width: 1400px;
    width: 95%;
}

/* Formulation Materials Drag & Drop */
.formulation-materials-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.formulation-material-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.formulation-material-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.drag-handle {
    cursor: grab;
    color: #A0AEC0;
    display: flex;
    align-items: center;
    padding: 0.25rem;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.material-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.material-info strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.material-info span {
    font-size: 0.85rem;
}

.material-quantity {
    width: 120px;
}

.material-quantity .form-control {
    padding: 0.5rem;
    font-size: 0.9rem;
}

.btn-remove {
    background: transparent;
    border: none;
    color: #E53E3E;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-remove:hover {
    background: #FFF5F5;
    color: #C53030;
}

.sortable-ghost {
    opacity: 0.4;
    background: #EDF2F7;
}

.batch-size-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    padding: 0.75rem;
    background-color: #F7FAFC;
    border-left: 4px solid var(--primary-color);
    margin-top: 0.5rem;
    border-radius: 4px;
}

.batch-size-display .text-muted {
    color: var(--text-muted);
    font-weight: 400;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: #F8FAFC;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.formulation-modal-header {
    align-items: flex-start;
    gap: 1rem;
}

.formulation-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #F8FAFC;
    border-radius: 0 0 12px 12px;
}

/* Dashboard Styles */
.dashboard {
    max-width: 100%;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-number.stat-warning {
    color: var(--warning-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.product-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.product-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-availability {
    margin-bottom: 1rem;
}

.availability-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.availability-badge.available {
    background-color: #F0FFF4;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.availability-badge.out-of-stock {
    background-color: #FED7D7;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.product-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #F8FAFC;
    border-radius: 8px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    display: block;
}

.stat small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Suppliers Column */
.suppliers-column {
    max-width: 200px;
}

.supplier-line {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #F1F5F9;
}

.supplier-line:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.supplier-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.phone-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.phone-link:hover {
    text-decoration: underline;
}

/* Formulation Styles */
.formulation-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.formulation-section h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.materials-table {
    margin-top: 1rem;
    overflow-x: auto;
}

.materials-table .table {
    width: 100%;
    border-collapse: collapse;
}

.materials-table .table th,
.materials-table .table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.materials-table .table th {
    background: #F8FAFC;
    font-weight: 500;
    color: var(--text-primary);
}

.materials-table .form-control {
    margin: 0;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Supplier Management */
.suppliers-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.suppliers-list {
    max-height: 300px;
    overflow-y: auto;
}

.supplier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #F8FAFC;
}

.supplier-details {
    flex: 1;
}

.supplier-details .supplier-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.supplier-details .supplier-phone {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.add-supplier-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Stock Check Modal */
.shortage-list {
    margin-top: 1rem;
}

.shortage-item {
    padding: 1rem;
    border: 1px solid var(--error-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: #FED7D7;
}

.shortage-item h4 {
    color: var(--error-color);
    margin-bottom: 0.5rem;
}

.supplier-info {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(245, 101, 101, 0.3);
}

.supplier-info .supplier {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Tablet Specific Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .action-group {
        flex-wrap: wrap;
    }

    .data-table .actions .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }
}

@media (max-width: 768px) {
    .nav-brand h1 {
        font-size: 1rem;
    }

    .nav-menu {
        gap: 0;
    }

    .nav-link {
        padding: 1rem 0.75rem;
        font-size: 0.875rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-controls {
        justify-content: stretch;
    }

    .filter-controls select {
        flex: 1;
        min-width: auto;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-height: 80vh;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-actions {
        flex-direction: column;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .suppliers-column {
        max-width: none;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* Action Groups Responsive */
    .action-groups {
        gap: 0.5rem;
    }

    .action-group {
        gap: 0.35rem;
    }

    .group-label {
        font-size: 0.8rem;
        width: 100%;
        margin-bottom: 0.15rem;
    }

    .data-table .actions .btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
        margin-right: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .action-btn,
    .report-btn {
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-section {
        padding: 1rem;
    }

    .product-stats {
        grid-template-columns: 1fr;
    }

    .stat {
        text-align: left;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .stat:last-child {
        border-bottom: none;
    }

    /* Action Groups Mobile */
    .action-groups {
        gap: 0.5rem;
    }

    .action-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.5rem;
        background: #f8f9fa;
        border-radius: 6px;
        border-left: 3px solid var(--primary-color);
    }

    .group-label {
        font-size: 0.75rem;
        font-weight: 700;
        width: 100%;
        margin-bottom: 0.25rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .data-table .actions .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.7rem;
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.3rem;
        text-align: center;
    }

    .data-table .actions .btn:last-child {
        margin-bottom: 0;
    }

    .action-btn,
    .report-btn {
        min-width: 100%;
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .page-header .actions,
    .controls-bar,
    .data-table .actions,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .main-content {
        max-width: none;
        padding: 0;
    }

    .dashboard-section,
    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
/* Remove number input spinners (up/down arrows) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Formulation drag-and-drop styling */
.formulation-materials-list {
    margin-top: 1rem;
}

.formulation-material-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.formulation-material-row:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(107, 63, 105, 0.1);
}

.drag-handle {
    cursor: move;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    padding: 0.25rem;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.material-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.material-info strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.material-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.material-quantity {
    width: 120px;
}

.material-quantity .form-control {
    text-align: right;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.sortable-ghost {
    opacity: 0.4;
    background: var(--bg-light);
}

@media (max-width: 768px) {
    .formulation-material-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .material-info {
        flex: 1 1 100%;
        order: 1;
    }
    
    .drag-handle {
        order: 0;
    }
    
    .material-quantity {
        order: 2;
        flex: 1;
    }
    
    .btn-remove {
        order: 3;
    }
}

/* Batch Preview Styles */
.batch-preview {
    max-width: 100%;
}

.preview-notice {
    margin-bottom: 20px;
}

.notice-box {
    background: #E6F3FF;
    border: 1px solid #4299E1;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.notice-box h4 {
    color: #2D3748;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.notice-box p {
    color: #4A5568;
    margin: 0;
    font-size: 0.95em;
}

.preview-section {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.preview-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.info-table td:first-child {
    width: 200px;
    font-weight: 600;
    color: var(--text-secondary);
}

.info-table td:last-child {
    font-weight: 500;
}

.materials-preview-table {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cost-table {
    min-width: 1000px;
    border-collapse: collapse;
}

.cost-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #E2E8F0;
}

.cost-table tbody tr:hover {
    background: #F8FAFC;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #E2E8F0;
}

.summary-table td:first-child {
    width: 250px;
    font-weight: 600;
}

.summary-table .grand-total-row td {
    border-top: 2px solid var(--success-color);
    background: #f0fff4;
    font-size: 1.05rem;
}

.summary-table .total-gst-row td {
    border-top: 2px solid #dee2e6;
}

.summary-table td:last-child {
    text-align: right;
    font-weight: 600;
}

/* Ensure summary tables inside preview modals align left and don't get centered by inline styles */
.modal .summary-table {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.total-row {
    background: #F7FAFC;
    border-top: 2px solid var(--primary-color);
}

.grand-total {
    color: var(--primary-color);
    font-size: 1.2em;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: 600;
}

.formulation-button {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.formulation-button-meta {
    font-size: 0.65rem;
    line-height: 1.1;
    opacity: 0.75;
    text-transform: none;
}

.formulation-modal-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}
