/* CRM Module Styles - ERP Exact Match */

/* Base overrides */
body {
    font-size: 12px;
    font-family: Verdana, Geneva, sans-serif;
    background: linear-gradient(135deg, #e6eaf7 0%, #dbeafe 50%, #e0f2fe 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Clear existing base styles if any */
a {
    color: #26375E;
    text-decoration: none;
}

a:visited {
    color: #26375E;
    text-decoration: none;
}

a:hover {
    color: rgb(13, 127, 180);
    text-decoration: underline;
}

/* ERP Spacing & Cards */
.bg-white {
    background: white;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #d1d5db;
    border-radius: 0;
}

/* Dashboard Specific Card Style from reference */
.bg-white.rounded-lg.shadow {
    background: white;
    border-radius: 0 !important;
    /* Explicitly rectangular per ERP style */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden;
    margin-bottom: 20px;
}

.bg-white.rounded-lg.shadow h2 {
    background: linear-gradient(to bottom, #eceff4, #d3d8dc) !important;
    color: #1d4e81 !important;
    font-size: 16px !important;
    font-weight: 600;
    padding: 6px 10px !important;
    margin: 0 !important;
    border-bottom: 1px solid #537396 !important;
}

/* Dashboard Tables */
.bg-white.rounded-lg.shadow table {
    width: 100%;
    border-collapse: collapse;
}

.bg-white.rounded-lg.shadow thead {
    background-color: #f5f7fa !important;
    border-bottom: 1px solid #537396 !important;
}

.bg-white.rounded-lg.shadow th {
    padding: 8px 10px;
    font-weight: 700;
    color: #1d4e81;
    /* Blue header text */
    text-align: left;
    font-size: 11px;
    /* Smaller ERP font */
    text-transform: uppercase;
    background-color: #f5f7fa;
}

.bg-white.rounded-lg.shadow td {
    padding: 6px 10px;
    border-bottom: 1px solid #e8eef3;
    font-size: 12px;
    color: #333;
}

.bg-white.rounded-lg.shadow tbody tr:hover {
    background-color: #e4f0fe;
}

/* Stats Cards (similar to Image 2 top cards) */
.card-stat {
    background: white;
    border: 1px solid #d1d5db;
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-stat-icon {
    font-size: 24px;
    margin-right: 15px;
    color: #1d4e81;
}

.card-stat-content {
    flex-grow: 1;
}

.card-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.card-stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

/* Title Bar - ERP Style */
.erp-title-bar {
    background: #ffffff;
    padding: 5px 10px;
    margin-bottom: 15px;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
}

.erp-title-center h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1d4e81;
    margin: 0;
}

.erp-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 0;
    color: #1d4e81;
    background: white;
    margin-right: 2px;
    font-size: 14px;
}

.erp-icon-btn:hover {
    background: #f0f0f0;
}

/* Grid Layouts */
.dashboard-grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .dashboard-grid-main {
        grid-template-columns: 1fr;
    }
}

.dashboard-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Legacy support for forms */
.crm-form-container {
    background: #E0E0E0;
    padding: 12px;
    border: 1px solid #8C8C8C;
    border-radius: 0;
}

.crm-input,
.crm-select,
.crm-textarea {
    font-size: 12px;
    padding: 4px;
    border: 1px solid #999;
}

.btn-primary {
    background-color: #15803d;
    color: white;
    padding: 6px 12px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
}


/* Empty State */
.crm-empty-state {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
}

/* --- Imported Modern Form Styles --- */
.modern-container {
    max-width: 900px;
    margin: 40px auto;
    font-family: 'Segoe UI', Inter, system-ui, sans-serif;
}

.modern-card {
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #eef2f6;
}

.modern-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modern-subtitle {
    color: #94a3b8;
    font-size: 13px;
    margin-top: 4px;
}

.modern-body {
    padding: 30px;
}

.modern-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.modern-col-12 {
    grid-column: span 12;
}

.modern-col-6 {
    grid-column: span 6;
}

.modern-col-4 {
    grid-column: span 4;
}

.modern-col-8 {
    grid-column: span 8;
}

@media (max-width: 768px) {

    .modern-col-6,
    .modern-col-4,
    .modern-col-8 {
        grid-column: span 12;
    }
}

.modern-form-group {
    margin-bottom: 5px;
}

.modern-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.modern-label span.required {
    color: #ef4444;
}

.modern-input,
.modern-select,
.modern-textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
    color: #334155;
}

.modern-input:focus,
.modern-select:focus,
.modern-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modern-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.modern-footer {
    background: #f8fafc;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-modern {
    padding: 10px 24px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
}

.btn-modern-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-modern-primary:hover {
    box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-modern-secondary {
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-modern-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #94a3b8;
}

/* Select2 Customization */
.select2-container .select2-selection--single {
    height: 42px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 0 !important;
    background-color: #f8fafc !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #334155 !important;
    font-size: 14px !important;
    padding-left: 14px !important;
    line-height: normal !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    right: 8px !important;
}

.select2-dropdown {
    border-radius: 0 !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* --- Custom Autocomplete Styles --- */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    display: none;
}

.autocomplete-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.autocomplete-no-results {
    padding: 10px 14px;
    font-size: 13px;
    font-style: italic;
}

/* --- Global Search Styles --- */
#globalSearchInput {
    padding: 6px 10px;
    border: none;
    border-radius: 0;
    font-size: 13px;
    width: 250px;
    outline: none;
    color: #333;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 2000;
    max-height: 400px;
    overflow-y: auto;
}

.search-category-header {
    padding: 6px 10px;
    background-color: #f1f5f9;
    font-weight: bold;
    color: #1d4e81;
    font-size: 12px;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
}

.search-result-item {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    border-bottom: 1px solid #f8fafc;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: #eff6ff;
    color: #1d4e81;
}