/* ============================================
   ENTERPRISE CRM STANDARD STYLES
   ============================================ */

/* Page Header - Enterprise Style */
.crm-page-header {
    background: #ffffff;
    padding: 1.5rem 1.5rem;
    margin: 0;
    border-bottom: 2px solid #f3f4f6;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    color: #1f2937;
}

.crm-page-header-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #111827;
    letter-spacing: -0.5px;
}

.crm-page-header-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0;
    font-weight: 500;
}

.crm-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.crm-header-actions .btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Neutral gray look only applies to buttons with no explicit Bootstrap
   color variant. Buttons that DO carry a variant (btn-primary, btn-success,
   btn-danger, btn-dark, btn-secondary, or any btn-outline-*) keep their own
   variant colors -- previously this rule's background/color overrode them
   unconditionally, leaving dark gray text on solid colored backgrounds
   (e.g. gray text on a blue btn-primary) across every page using this
   header-actions pattern. */
.crm-header-actions .btn:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-dark):not(.btn-light):not([class*="btn-outline-"]) {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #4b5563;
}

.crm-header-actions .btn:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-dark):not(.btn-light):not([class*="btn-outline-"]):hover {
    background: #e5e7eb;
    color: #111827;
    transform: translateY(-1px);
}

/* Status Badge - Modern */
.crm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #1b5e20;
}

.crm-status-badge i {
    font-size: 1rem;
}

/* Info Cards - Sleek Design */
.crm-info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.crm-info-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.crm-info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #667eea;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.crm-info-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.crm-info-card:hover::before {
    opacity: 1;
}

.crm-info-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: block;
}

.crm-info-card-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    display: block;
}

/* =============================================
   ENHANCED CRM STATS CARDS (GLOBAL)
============================================= */

.crm-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1400px) {
    .crm-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .crm-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .crm-metrics {
        grid-template-columns: 1fr;
    }
}

.crm-metric-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: none !important;
}

.crm-metric-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Subtle background accent blob */
.crm-metric-card::after {
    content: '';
    position: absolute;
    bottom: -18px;
    right: -18px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.07;
    background: currentColor;
    transition: opacity 0.2s;
}

.crm-metric-card:hover::after {
    opacity: 0.12;
}

/* Side-by-side header */
.crm-metric-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}

.crm-metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    margin: 0 !important;
    /* Override legacy margins */
}

.crm-metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
    margin: 0 !important;
}

.crm-metric-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: #64748b;
    text-transform: none !important;
    /* Remove legacy uppercase */
    letter-spacing: 0 !important;
    margin-bottom: 0.25rem !important;
    position: relative;
    z-index: 1;
}

.crm-metric-change {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.725rem;
    font-weight: 600;
    color: #94a3b8;
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 0.25rem 0.6rem;
    width: fit-content;
    margin-top: 0.15rem;
    border: none !important;
    position: relative;
    z-index: 1;
}

.crm-metric-change i {
    font-size: 0.8rem;
}

/* Color Palette Variants */
.crm-metric-card.stat-primary .crm-metric-icon {
    background: #eef2ff;
    color: #4f46e5;
}

.crm-metric-card.stat-primary .crm-metric-value {
    color: #4f46e5;
}

.crm-metric-card.stat-primary::after {
    color: #4f46e5;
}

.crm-metric-card.stat-success .crm-metric-icon {
    background: #f0fdf4;
    color: #166534;
}

.crm-metric-card.stat-success .crm-metric-value {
    color: #166534;
}

.crm-metric-card.stat-success::after {
    color: #166534;
}

.crm-metric-card.stat-warning .crm-metric-icon {
    background: #fffbeb;
    color: #92400e;
}

.crm-metric-card.stat-warning .crm-metric-value {
    color: #92400e;
}

.crm-metric-card.stat-warning::after {
    color: #92400e;
}

.crm-metric-card.stat-danger .crm-metric-icon {
    background: #fef2f2;
    color: #991b1b;
}

.crm-metric-card.stat-danger .crm-metric-value {
    color: #991b1b;
}

.crm-metric-card.stat-danger::after {
    color: #991b1b;
}

.crm-metric-card.stat-info .crm-metric-icon {
    background: #f0f9ff;
    color: #0369a1;
}

.crm-metric-card.stat-info .crm-metric-value {
    color: #0369a1;
}

.crm-metric-card.stat-info::after {
    color: #0369a1;
}

.crm-metric-card.stat-purple .crm-metric-icon {
    background: #faf5ff;
    color: #7e22ce;
}

.crm-metric-card.stat-purple .crm-metric-value {
    color: #7e22ce;
}

.crm-metric-card.stat-purple::after {
    color: #7e22ce;
}




/* Form Sections - Clean & Organized */
.crm-form-section {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.crm-form-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.crm-form-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.crm-form-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.crm-form-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

/* Sidebar - Modern Sticky */
.crm-sidebar {
    /* position: sticky; */
    top: 1rem;
}

.crm-sidebar-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.crm-sidebar-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
    background: transparent !important;
}

.crm-sidebar-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: rgba(27, 94, 32, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.crm-sidebar-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

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

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

.crm-summary-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.crm-summary-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
}

.crm-summary-total {
    background: #667eea;
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-top: 1rem;
}

.crm-summary-total .crm-summary-label,
.crm-summary-total .crm-summary-value {
    color: white;
    font-size: 1rem;
}

/* Table - Modern Design */
.crm-table-container {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.crm-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.crm-table-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.crm-table-title i {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.table-crm {
    margin-bottom: 0;
}

.table-crm thead th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
    padding: 1rem;
}

.table-crm tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
}

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

/* Action Buttons - Modern */
.crm-actions {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    bottom: 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.crm-actions-left,
.crm-actions-right {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-crm {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-crm-primary {
    background: #667eea;
    color: white;
    border: none;
}

.btn-crm-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-crm-success {
    background: #1b5e20;
    color: white;
    border: none;
}

.btn-crm-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
    color: white;
}

.btn-crm-secondary {
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.btn-crm-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

/* Form Inputs - Enhanced */
.form-floating-outline .form-control,
.form-floating-outline .form-select {
    border: 1.5px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.form-floating-outline .form-control:focus,
.form-floating-outline .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-floating-outline.border-success .form-control,
.form-floating-outline.border-success .form-select {
    border-color: #1b5e20 !important;
}

.form-floating-outline.border-success label,
.form-floating-outline label.text-success {
    color: #1b5e20 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .crm-page-header {
        padding: 1.5rem;
    }

    .crm-page-header-title {
        font-size: 1.5rem;
    }

    .crm-metrics {
        grid-template-columns: 1fr;
    }

    .crm-info-cards {
        grid-template-columns: 1fr;
    }

    .crm-actions {
        flex-direction: column;
    }

    .crm-actions-left,
    .crm-actions-right {
        width: 100%;
        justify-content: center;
    }
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crm-metric-card,
.crm-info-card,
.crm-form-section {
    animation: slideInUp 0.5s ease-out;
}

.crm-metric-card:nth-child(1) {
    animation-delay: 0.1s;
}

.crm-metric-card:nth-child(2) {
    animation-delay: 0.2s;
}

.crm-metric-card:nth-child(3) {
    animation-delay: 0.3s;
}

.crm-metric-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* 
   AGRESSIVE DARK GREEN OVERRIDE 
   Targeting the specific RGB (114, 225, 40) or #72e128 
*/

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"],
body {
    --bs-success: #1b5e20 !important;
    --bs-success-rgb: 27, 94, 32 !important;
    --bs-success-bg-subtle: #e8f5e9 !important;
    --bs-success-border-subtle: #1b5e20 !important;
    --bs-success-text-emphasis: #1b5e20 !important;

    /* Theme specific variables if they exist */
    --success: #1b5e20 !important;
}

/* Force override by color value */
*[style*="color: rgb(114, 225, 40)"],
*[style*="color: #72e128"],
*[style*="color:#72e128"] {
    color: #1b5e20 !important;
}

/* Redefine Success Classes with !important */
.text-success {
    color: #1b5e20 !important;
}

.bg-success {
    background-color: #1b5e20 !important;
}

.bg-label-success {
    background-color: rgba(27, 94, 32, 0.12) !important;
    color: #1b5e20 !important;
}

.border-success {
    border-color: #1b5e20 !important;
}

/* Specifically for Input fields and Labels in Vuexy/Bootstrap */
.form-control.text-success,
.form-select.text-success,
.input-group-text.text-success {
    color: #1b5e20 !important;
    font-weight: 700 !important;
}

.form-floating-outline .form-control.text-success~label,
.form-floating-outline label.text-success {
    color: #1b5e20 !important;
}

/* Handle focus states */
.form-control:focus.text-success {
    border-color: #1b5e20 !important;
    box-shadow: 0 0 0 0.25rem rgba(27, 94, 32, 0.25) !important;
}

/* Buttons */
.btn-success {
    background-color: #1b5e20 !important;
    border-color: #1b5e20 !important;
}

.btn-outline-success {
    color: #1b5e20 !important;
    border-color: #1b5e20 !important;
}

.btn-outline-success:hover {
    background-color: #1b5e20 !important;
    color: #fff !important;
}

/* ============================================
   UNIFORM ADMIN TEXT SIZE
   Baseline body/UI text size across the admin
   panel, matched to the sidebar menu link size
   (.backend-sidebar.menu-vertical .menu-inner > .menu-item > .menu-link).
   Page-specific styles (page-style blocks) can
   still override this for headings/hero numbers.
   ============================================ */
.content-wrapper table,
.content-wrapper .table,
.content-wrapper td,
.content-wrapper th,
.content-wrapper .btn,
.content-wrapper .form-control,
.content-wrapper .form-select,
.content-wrapper .form-label,
.content-wrapper .form-check-label,
.content-wrapper .input-group-text,
.content-wrapper .dropdown-item,
.content-wrapper label,
.content-wrapper small {
    font-size: 0.8125rem;
}