/* Themes for HealthPlus ERP */

/* Smooth Transitions */
body {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.navbar, .sidebar, .card, .form-control, .form-select, .table, th, td {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Light Theme (Default fallback) */
body.theme-light, body.theme-indigo {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Emerald Theme */
body.theme-emerald {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --primary-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Rose Theme */
body.theme-rose {
    --primary-color: #f43f5e;
    --primary-hover: #e11d48;
    --primary-gradient: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Amber Theme */
body.theme-amber {
    --primary-color: #f59e0b;
    --primary-hover: #d97706;
    --primary-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Ocean Theme */
body.theme-ocean {
    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Lavender Theme */
body.theme-colorful, body.theme-lavender {
    --primary-color: #a855f7;
    --primary-hover: #9333ea;
    --primary-gradient: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-hover-bg: #f1f5f9;
}

/* Midnight Theme (Professional Dark Theme) */
body.theme-dark, body.theme-midnight {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --input-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-hover-bg: #334155;
}

/* Generic Global Theme overrides */
body {
    background-color: var(--body-bg) !important;
    color: var(--text-main) !important;
}

/* Dark mode specific style overrides */
body.theme-dark .navbar, 
body.theme-dark .card,
body.theme-dark .modal-content,
body.theme-midnight .navbar, 
body.theme-midnight .card,
body.theme-midnight .modal-content {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

body.theme-dark .sidebar,
body.theme-midnight .sidebar {
    background-color: var(--sidebar-bg) !important;
}
body.theme-dark .sidebar .nav-link,
body.theme-midnight .sidebar .nav-link {
    color: var(--sidebar-text) !important;
}
body.theme-dark .sidebar .nav-link:hover,
body.theme-dark .sidebar .nav-link.active,
body.theme-midnight .sidebar .nav-link:hover,
body.theme-midnight .sidebar .nav-link.active {
    background: var(--sidebar-hover-bg) !important;
    color: #fff !important;
}

body.theme-dark .table-responsive,
body.theme-midnight .table-responsive {
    background: var(--card-bg) !important;
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

body.theme-dark .table,
body.theme-midnight .table {
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
    --bs-table-bg: transparent !important;
    background-color: transparent !important;
}
body.theme-dark .table th,
body.theme-midnight .table th {
    background-color: #0f172a !important;
    color: var(--text-muted) !important;
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .table td,
body.theme-midnight .table td {
    border-bottom-color: var(--border-color) !important;
    color: var(--text-main) !important;
    background-color: transparent !important;
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-midnight .form-control,
body.theme-midnight .form-select {
    background-color: var(--input-bg) !important;
    color: #fff !important;
    border-color: var(--border-color) !important;
}

/* Colorful/Lavender mode specific overrides */
body.theme-colorful .sidebar,
body.theme-lavender .sidebar {
    background: #2e1065 !important;
}
body.theme-colorful .sidebar .nav-link,
body.theme-lavender .sidebar .nav-link {
    color: #ddd6fe !important;
}
body.theme-colorful .sidebar .nav-link:hover,
body.theme-colorful .sidebar .nav-link.active,
body.theme-lavender .sidebar .nav-link:hover,
body.theme-lavender .sidebar .nav-link.active {
    background: #4c1d95 !important;
    color: #fff !important;
}
body.theme-colorful .navbar,
body.theme-lavender .navbar {
    background: #ffffff !important;
    border-bottom: 2px solid var(--primary-color) !important;
}

/* Global Attribute Overrides for Dark Modes */
body.theme-dark [style*="background: #fff"],
body.theme-midnight [style*="background: #fff"],
body.theme-dark [style*="background:#fff"],
body.theme-midnight [style*="background:#fff"],
body.theme-dark [style*="background: white"],
body.theme-midnight [style*="background: white"],
body.theme-dark [style*="background-color: #fff"],
body.theme-midnight [style*="background-color: #fff"],
body.theme-dark [style*="background-color:#fff"],
body.theme-midnight [style*="background-color:#fff"],
body.theme-dark [style*="background: #ffffff"],
body.theme-midnight [style*="background: #ffffff"],
body.theme-dark [style*="background:#ffffff"],
body.theme-midnight [style*="background:#ffffff"],
body.theme-dark [style*="background-color: #ffffff"],
body.theme-midnight [style*="background-color: #ffffff"],
body.theme-dark [style*="background-color:#ffffff"],
body.theme-midnight [style*="background-color:#ffffff"] {
    background-color: var(--card-bg) !important;
    background: var(--card-bg) !important;
}

body.theme-dark [style*="background: #f8fafc"],
body.theme-midnight [style*="background: #f8fafc"],
body.theme-dark [style*="background:#f8fafc"],
body.theme-midnight [style*="background:#f8fafc"],
body.theme-dark [style*="background: #fafafa"],
body.theme-midnight [style*="background: #fafafa"],
body.theme-dark [style*="background:#fafafa"],
body.theme-midnight [style*="background:#fafafa"],
body.theme-dark [style*="background-color: #fafafa"],
body.theme-midnight [style*="background-color: #fafafa"],
body.theme-dark [style*="background-color:#fafafa"],
body.theme-midnight [style*="background-color:#fafafa"],
body.theme-dark [style*="background: #f1f5f9"],
body.theme-midnight [style*="background: #f1f5f9"],
body.theme-dark [style*="background:#f1f5f9"],
body.theme-midnight [style*="background:#f1f5f9"],
body.theme-dark [style*="background-color: #f1f5f9"],
body.theme-midnight [style*="background-color: #f1f5f9"],
body.theme-dark [style*="background-color:#f1f5f9"],
body.theme-midnight [style*="background-color:#f1f5f9"] {
    background-color: var(--body-bg) !important;
    background: var(--body-bg) !important;
}

body.theme-dark [style*="color: #1e293b"],
body.theme-midnight [style*="color: #1e293b"],
body.theme-dark [style*="color:#1e293b"],
body.theme-midnight [style*="color:#1e293b"] {
    color: var(--text-main) !important;
}

body.theme-dark [style*="color: #475569"],
body.theme-midnight [style*="color: #475569"],
body.theme-dark [style*="color: #64748b"],
body.theme-midnight [style*="color: #64748b"] {
    color: var(--text-muted) !important;
}

body.theme-dark tr[style*="background"],
body.theme-midnight tr[style*="background"],
body.theme-dark tr,
body.theme-midnight tr,
body.theme-dark td,
body.theme-midnight td,
body.theme-dark th,
body.theme-midnight th {
    background-color: transparent !important;
}

/* Inputs, Selects, Textareas Dark Mode Overrides */
body.theme-dark input,
body.theme-midnight input,
body.theme-dark select,
body.theme-midnight select,
body.theme-dark textarea,
body.theme-midnight textarea {
    background-color: var(--input-bg) !important;
    color: #fff !important;
    border-color: var(--border-color) !important;
}

/* Purchase Page Class Overrides */
body.theme-dark .pur-card,
body.theme-midnight .pur-card {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}
body.theme-dark .pur-header,
body.theme-midnight .pur-header {
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .pur-title,
body.theme-midnight .pur-title {
    color: var(--text-main) !important;
}
body.theme-dark .pur-meta,
body.theme-midnight .pur-meta {
    background: var(--body-bg) !important;
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .pur-meta label,
body.theme-midnight .pur-meta label {
    color: var(--text-muted) !important;
}
body.theme-dark .pur-totals-box,
body.theme-midnight .pur-totals-box {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}
body.theme-dark .pur-total-line,
body.theme-midnight .pur-total-line {
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .pur-total-val,
body.theme-midnight .pur-total-val,
body.theme-dark .pur-total-grand .pur-total-val,
body.theme-midnight .pur-total-grand .pur-total-val {
    color: var(--text-main) !important;
}
body.theme-dark .pur-footer,
body.theme-midnight .pur-footer {
    background: var(--body-bg) !important;
    border-top-color: var(--border-color) !important;
}
body.theme-dark .pur-row-total,
body.theme-midnight .pur-row-total {
    color: var(--text-main) !important;
}

/* Return Page Class Overrides */
body.theme-dark .ret-card,
body.theme-midnight .ret-card {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}
body.theme-dark .ret-header,
body.theme-midnight .ret-header {
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .ret-title,
body.theme-midnight .ret-title {
    color: var(--text-main) !important;
}
body.theme-dark .ret-meta,
body.theme-midnight .ret-meta {
    background: var(--body-bg) !important;
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .ret-meta label,
body.theme-midnight .ret-meta label {
    color: var(--text-muted) !important;
}
body.theme-dark .ret-meta select,
body.theme-midnight .ret-meta select,
body.theme-dark .ret-meta input,
body.theme-midnight .ret-meta input {
    background: var(--input-bg) !important;
    color: #fff !important;
    border-color: var(--border-color) !important;
}
body.theme-dark .ret-sel,
body.theme-midnight .ret-sel,
body.theme-dark .ret-inp,
body.theme-midnight .ret-inp {
    background: var(--input-bg) !important;
    color: #fff !important;
    border-color: var(--border-color) !important;
}
body.theme-dark .ret-inp-readonly,
body.theme-midnight .ret-inp-readonly {
    background: var(--body-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}
body.theme-dark .ret-row-total,
body.theme-midnight .ret-row-total {
    color: var(--text-main) !important;
}
body.theme-dark .ret-add-btn,
body.theme-midnight .ret-add-btn {
    background: var(--body-bg) !important;
    color: var(--primary-color) !important;
    border-color: var(--border-color) !important;
}
body.theme-dark .ret-totals,
body.theme-midnight .ret-totals {
    background: var(--body-bg) !important;
    border-color: var(--border-color) !important;
}
body.theme-dark .ret-totals-row,
body.theme-midnight .ret-totals-row {
    color: var(--text-muted) !important;
}
body.theme-dark .ret-totals-row span:last-child,
body.theme-midnight .ret-totals-row span:last-child {
    color: var(--text-main) !important;
}
body.theme-dark .ret-totals-grand,
body.theme-midnight .ret-totals-grand {
    border-top-color: var(--border-color) !important;
}
body.theme-dark .ret-totals-grand span:first-child,
body.theme-midnight .ret-totals-grand span:first-child {
    color: var(--text-main) !important;
}
body.theme-dark .ret-totals-grand span:last-child,
body.theme-midnight .ret-totals-grand span:last-child {
    color: var(--text-main) !important;
}
body.theme-dark .ret-table thead th,
body.theme-midnight .ret-table thead th {
    border-bottom-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}
body.theme-dark .ret-table tbody td,
body.theme-midnight .ret-table tbody td {
    border-bottom-color: var(--border-color) !important;
}
body.theme-dark .ret-remove-btn:hover,
body.theme-midnight .ret-remove-btn:hover {
    background: var(--body-bg) !important;
}
body.theme-dark .ret-table tbody tr:hover,
body.theme-midnight .ret-table tbody tr:hover {
    background: var(--body-bg) !important;
}

/* Premium Soft-Color Semantic Overrides for Dark Modes */
body.theme-dark [style*="background: #fff1f2"],
body.theme-midnight [style*="background: #fff1f2"],
body.theme-dark [style*="background:#fff1f2"],
body.theme-midnight [style*="background:#fff1f2"],
body.theme-dark [style*="background: #fee2e2"],
body.theme-midnight [style*="background: #fee2e2"],
body.theme-dark [style*="background:#fee2e2"],
body.theme-midnight [style*="background:#fee2e2"] {
    background-color: rgba(239, 68, 68, 0.15) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

body.theme-dark [style*="background: #ecfdf5"],
body.theme-midnight [style*="background: #ecfdf5"],
body.theme-dark [style*="background:#ecfdf5"],
body.theme-midnight [style*="background:#ecfdf5"],
body.theme-dark [style*="background: #d1fae5"],
body.theme-midnight [style*="background: #d1fae5"],
body.theme-dark [style*="background:#d1fae5"],
body.theme-midnight [style*="background:#d1fae5"],
body.theme-dark [style*="background: #dcfce7"],
body.theme-midnight [style*="background: #dcfce7"],
body.theme-dark [style*="background:#dcfce7"],
body.theme-midnight [style*="background:#dcfce7"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    background: rgba(16, 185, 129, 0.15) !important;
    color: #a7f3d0 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

body.theme-dark [style*="background: #f0f9ff"],
body.theme-midnight [style*="background: #f0f9ff"],
body.theme-dark [style*="background:#f0f9ff"],
body.theme-midnight [style*="background:#f0f9ff"],
body.theme-dark [style*="background: #e0f2fe"],
body.theme-midnight [style*="background: #e0f2fe"],
body.theme-dark [style*="background:#e0f2fe"],
body.theme-midnight [style*="background:#e0f2fe"] {
    background-color: rgba(14, 165, 233, 0.15) !important;
    background: rgba(14, 165, 233, 0.15) !important;
    color: #bae6fd !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
}

body.theme-dark [style*="background: #fffbeb"],
body.theme-midnight [style*="background: #fffbeb"],
body.theme-dark [style*="background:#fffbeb"],
body.theme-midnight [style*="background:#fffbeb"],
body.theme-dark [style*="background: #fef3c7"],
body.theme-midnight [style*="background: #fef3c7"],
body.theme-dark [style*="background:#fef3c7"],
body.theme-midnight [style*="background:#fef3c7"],
body.theme-dark [style*="background: #fef9c3"],
body.theme-midnight [style*="background: #fef9c3"],
body.theme-dark [style*="background:#fef9c3"],
body.theme-midnight [style*="background:#fef9c3"] {
    background-color: rgba(245, 158, 11, 0.15) !important;
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fde68a !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

body.theme-dark [style*="background: #f5f3ff"],
body.theme-midnight [style*="background: #f5f3ff"],
body.theme-dark [style*="background:#f5f3ff"],
body.theme-midnight [style*="background:#f5f3ff"],
body.theme-dark [style*="background: #eef2ff"],
body.theme-midnight [style*="background: #eef2ff"],
body.theme-dark [style*="background:#eef2ff"],
body.theme-midnight [style*="background:#eef2ff"] {
    background-color: rgba(99, 102, 241, 0.15) !important;
    background: rgba(99, 102, 241, 0.15) !important;
    color: #c7d2fe !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}
