/* Global Styles for ERP System */

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #e9ecef;
    color: #212529;
    font-size: 0.9rem;
}

/* Heading size adjustments */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.15rem;
}

h4 {
    font-size: 1.05rem;
}

h5 {
    font-size: 0.95rem;
}

h3.fw-bold {
    font-size: 1.25rem;
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: 8px;
}

.card-body {
    padding: 1.25rem;
}

/* Button Enhancements */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    background-color: #f9fafb;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-color: #ffffff;
    outline: none;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-label {
    font-weight: 400;
    margin-bottom: 0.375rem;
    color: #6b7280;
    font-size: 0.8125rem;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

/* Table Enhancements */
.table {
    font-size: 0.875rem;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

.table td, .table th {
    padding: 0.65rem 1rem;
}

/* Badge Enhancements */
.badge {
    padding: 0.35rem 0.65rem;
    font-weight: 500;
    border-radius: 6px;
    font-size: 0.7rem;
}

/* Alert Enhancements */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
}

/* Breadcrumb Enhancements */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.25rem;
    padding: 0 0.25rem;
}

/* Pagination Enhancements */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    color: #0d6efd;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Crispy Forms Enhancements */
.asteriskField {
    display: none;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    border-radius: 4px;
}

.form-check-label {
    margin-left: 0.5rem;
    font-weight: 500;
}

/* Checkbox list for permissions */
.form-check {
    padding-left: 0;
    margin-bottom: 0.75rem;
}

.form-check input[type="checkbox"] {
    float: left;
    margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
}

/* Loading state */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* Shadow utilities */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Hover effects for cards */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Checkbox Styling - Override Bootstrap defaults */
.form-check {
    display: flex !important;
    align-items: center !important;
    min-height: 1.5rem !important;
    padding-left: 0 !important;
    margin-bottom: 0.75rem !important;
}

.form-check-input {
    width: 1.125rem !important;
    height: 1.125rem !important;
    margin-top: 0 !important;
    margin-right: 0.625rem !important;
    margin-left: 0 !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    background-color: white !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease-in-out !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    position: relative !important;
    float: none !important;
}

.form-check-input:hover {
    border-color: #9ca3af !important;
}

.form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.form-check-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
}

.form-check-input:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background-color: #f3f4f6 !important;
}

.form-check-label {
    cursor: pointer !important;
    user-select: none !important;
    color: #374151 !important;
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
    padding-left: 0 !important;
}

.form-check-input:disabled ~ .form-check-label {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Checkbox in forms - better spacing */
.erp-form-body .form-check {
    padding: 0.625rem 0 !important;
}

/* Multiple checkboxes in a row */
.row .form-check {
    margin-bottom: 0.5rem !important;
    padding: 0.5rem 0 !important;
}

/* Checkboxes in tables - centered and standalone */
.erp-table th .form-check-input,
.erp-table td .form-check-input {
    margin: 0 auto !important;
    display: block !important;
}

.erp-table th,
.erp-table td {
    vertical-align: middle !important;
}

/* Status Badge Styling */
.badge-active {
    background-color: #198754 !important;
    color: white;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
}

.badge-inactive {
    background-color: #dc3545 !important;
    color: white;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
}

/* Table Row Hover */
.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Alternating Table Rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* ERPNext-Style Layout */
.erp-page {
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Breadcrumb */
.erp-breadcrumb {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.erp-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.erp-breadcrumb .breadcrumb-item {
    font-size: 0.875rem;
    color: #6b7280;
}

.erp-breadcrumb .breadcrumb-item a {
    color: #6b7280;
    text-decoration: none;
}

.erp-breadcrumb .breadcrumb-item a:hover {
    color: #111827;
}

.erp-breadcrumb .breadcrumb-item.active {
    color: #111827;
    font-weight: 500;
}

.erp-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #d1d5db;
    padding: 0 0.35rem;
}

.erp-actions {
    display: flex;
    align-items: center;
}

/* List Header */
.erp-list-header {
    background-color: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.erp-filter-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s;
}

.erp-filter-badge:hover {
    background-color: #e5e7eb;
}

/* Table Container */
.erp-table-container {
    background-color: white;
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.erp-table thead {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.erp-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    color: #6b7280;
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: normal;
}

.erp-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s;
}

.erp-table tbody tr:hover {
    background-color: #f9fafb;
}

.erp-table tbody td {
    padding: 0.875rem 1rem;
    color: #374151;
}

.erp-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.erp-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ERPNext-style Badges */
.erp-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25;
}

.erp-badge-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.erp-badge-gray {
    background-color: #f3f4f6;
    color: #6b7280;
}

.erp-badge-green {
    background-color: #d1fae5;
    color: #065f46;
}

.erp-badge-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.erp-badge-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

/* Pagination */
.erp-pagination {
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Form Styling - ERPNext Style */
.erp-form-section {
    background-color: white;
    margin-bottom: 1rem;
}

.erp-form-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.erp-form-body {
    padding: 1.5rem;
}

.erp-form-group {
    margin-bottom: 1.25rem;
}

.erp-form-label {
    display: block;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.375rem;
    font-weight: 400;
}

.erp-form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #f9fafb;
    transition: all 0.15s;
}

.erp-form-control:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tabs - ERPNext Style */
.erp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
    padding: 0 1.5rem;
}

.erp-tab {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.erp-tab:hover {
    color: #111827;
}

.erp-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Checkbox Styling */
.form-check-input {
    cursor: pointer;
}

/* Button Adjustments */
.btn-light {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    color: #374151;
}

.btn-light:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

.btn-dark {
    background-color: #111827;
    border-color: #111827;
}

.btn-dark:hover {
    background-color: #000000;
    border-color: #000000;
}
