/* Professional Commercial Pharmacy ERP Dense Style Guide */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --erp-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --erp-mono-font: 'JetBrains Mono', monospace;
    --erp-bg-color: #f4f6f9;
    --erp-sidebar-bg: #1e293b;
    --erp-sidebar-active: #0f172a;
    --erp-border-color: #e2e8f0;
    --erp-primary-blue: #2563eb;
    --erp-primary-hover: #1d4ed8;
    --erp-text-color: #334155;
    --erp-text-muted: #64748b;
    --erp-card-bg: #ffffff;
    --erp-font-size: 13px;
    --erp-font-size-small: 12px;
}

body {
    font-family: var(--erp-font-family);
    font-size: var(--erp-font-size);
    background-color: var(--erp-bg-color);
    color: var(--erp-text-color);
    margin: 0;
    overflow-x: hidden;
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #0f172a;
}

p, span, label, input, select, textarea, button, table {
    font-size: var(--erp-font-size) !important;
}

.font-monospace {
    font-family: var(--erp-mono-font) !important;
}

/* Layout */
#app-wrapper {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: 220px;
    background-color: var(--erp-sidebar-bg);
    color: #f8fafc;
    flex-shrink: 0;
    transition: width 0.2s ease;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

#sidebar.collapsed {
    width: 50px;
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#top-header {
    background-color: #ffffff;
    height: 44px;
    border-bottom: 1px solid var(--erp-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

#content-body {
    padding: 10px;
    flex-grow: 1;
}

/* Collapsible Sidebar Menu styling */
.sidebar-brand {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #334155;
    background-color: var(--erp-sidebar-active);
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 14px !important;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    color: #cbd5e1;
    text-decoration: none;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-menu-item a:hover {
    background-color: #334155;
    color: #ffffff;
}

.sidebar-menu-item.active a {
    background-color: var(--erp-sidebar-active);
    color: #ffffff;
    border-left-color: var(--erp-primary-blue);
}

.sidebar-menu-item a i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

#sidebar.collapsed .sidebar-menu-item a span, 
#sidebar.collapsed .sidebar-brand span {
    display: none;
}

#sidebar.collapsed .sidebar-menu-item a i {
    margin-right: 0;
}

/* Header Styles */
.header-search {
    width: 240px;
}

.header-search input {
    height: 28px;
    padding: 3px 10px;
}

.user-profile-dropdown img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dense Card Design */
.card {
    background-color: var(--erp-card-bg);
    border: 1px solid var(--erp-border-color);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--erp-border-color);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 13px !important;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 10px;
}

/* Compact Forms styling */
.form-label {
    margin-bottom: 2px;
    font-weight: 500;
    font-size: var(--erp-font-size-small) !important;
}

.form-control, .form-select {
    padding: 4px 8px;
    height: 28px;
    border-radius: 2px;
    border: 1px solid #cbd5e1;
    font-size: var(--erp-font-size) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--erp-primary-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    height: auto;
}

.required-indicator {
    color: #ef4444;
    margin-left: 2px;
}

/* Custom Tiny Button sizes (Dense theme) */
.btn {
    padding: 4px 10px;
    font-size: var(--erp-font-size) !important;
    border-radius: 2px;
}

.btn-sm {
    padding: 2px 6px;
    font-size: var(--erp-font-size-small) !important;
}

.btn-xs {
    padding: 1px 4px;
    font-size: 11px !important;
}

.btn-primary {
    background-color: var(--erp-primary-blue);
    border-color: var(--erp-primary-blue);
}

.btn-primary:hover {
    background-color: var(--erp-primary-hover);
    border-color: var(--erp-primary-hover);
}

/* Dense DataTables override styling */
table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
}

table.dataTable thead th {
    background-color: #f1f5f9;
    color: #334155;
    font-weight: 600;
    border-bottom: 1px solid #cbd5e1 !important;
    padding: 6px 10px !important;
    font-size: var(--erp-font-size-small) !important;
}

table.dataTable tbody td {
    padding: 5px 10px !important;
    border-bottom: 1px solid var(--erp-border-color) !important;
    vertical-align: middle;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 2px 6px !important;
    font-size: var(--erp-font-size-small) !important;
}

/* Dashboard stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.stat-widget {
    background-color: #ffffff;
    border: 1px solid var(--erp-border-color);
    padding: 8px 10px;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-widget-label {
    font-size: 11px !important;
    color: var(--erp-text-muted);
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 3px;
}

.stat-widget-value {
    font-size: 16px !important;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-widget-footer {
    font-size: 10px !important;
    color: var(--erp-text-muted);
    margin-top: 2px;
}

/* Login Page specific CSS */
.login-body {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    width: 360px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    background-color: #ffffff;
    padding: 20px;
}

.caps-warning {
    display: none;
    font-size: 11px !important;
    padding: 2px 5px;
    border-radius: 2px;
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fef3c7;
    margin-top: 4px;
}

/* Spinner Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.erp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top: 3px solid var(--erp-primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}
