/**
 * Dream Built Homes CRM - Enterprise Core Design Tokens & Modular Styles
 * Palette: Deep Executive Navy (#0B132B, #1C2541), Warm Architectural Gold (#D4AF37, #C5A028),
 * Clean Crisp Slate Grays (#F8FAFC, #E2E8F0, #475569)
 */

:root {
    --crm-navy: #0B132B;
    --crm-navy-light: #1C2541;
    --crm-navy-dark: #070B1A;
    --crm-gold: #D4AF37;
    --crm-gold-dark: #B89523;
    --crm-gold-subtle: #FCF8EA;
    --crm-slate-50: #F8FAFC;
    --crm-slate-100: #F1F5F9;
    --crm-slate-200: #E2E8F0;
    --crm-slate-600: #475569;
    --crm-sidebar-width: 260px;
    --crm-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.crm-body {
    font-family: var(--crm-font-sans);
    background-color: var(--crm-slate-50);
    color: #1E293B;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Utilities & Brand Colors */
.bg-navy { background-color: var(--crm-navy) !important; }
.bg-navy-light { background-color: var(--crm-navy-light) !important; }
.bg-navy-subtle { background-color: #EBF0F8 !important; }
.text-navy { color: var(--crm-navy) !important; }
.text-navy-dark { color: var(--crm-navy-dark) !important; }

.bg-gold { background-color: var(--crm-gold) !important; }
.bg-gold-subtle { background-color: var(--crm-gold-subtle) !important; }
.text-gold { color: var(--crm-gold) !important; }
.text-gold-dark { color: var(--crm-gold-dark) !important; }

.bg-slate-50 { background-color: var(--crm-slate-50) !important; }
.bg-slate-100 { background-color: var(--crm-slate-100) !important; }

/* Enhanced Modern UI Card & Surfaces */
.card {
    border-radius: 12px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 10px 20px -5px rgba(15, 23, 42, 0.03) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 20px 25px -5px rgba(15, 23, 42, 0.05) !important;
}

/* Modern Tables */
.table {
    border-color: #F1F5F9;
}
.table thead th {
    background-color: #F8FAFC !important;
    color: #475569 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.85rem 1rem !important;
    border-bottom: 1px solid #E2E8F0 !important;
}
.table tbody td {
    padding: 0.85rem 1rem !important;
    vertical-align: middle;
    border-bottom: 1px solid #F1F5F9;
}
.table-hover tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.95) !important;
}

/* Action Dropdowns & Buttons */
.btn-action-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.btn-action-icon:hover {
    transform: translateY(-1px);
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    line-height: 1.2;
}

.btn-xxs {
    padding: 0.15rem 0.35rem;
    font-size: 0.68rem;
    border-radius: 4px;
    line-height: 1;
}

/* Empty State Widget */
.crm-empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
}
.crm-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #64748B;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-navy {
    background-color: var(--crm-navy);
    color: #FFFFFF;
    border: 1px solid var(--crm-navy);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.15s ease;
}
.btn-navy:hover {
    background-color: var(--crm-navy-light);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-outline-navy {
    border-color: var(--crm-navy);
    color: var(--crm-navy);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.15s ease;
}
.btn-outline-navy:hover {
    background-color: var(--crm-navy);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-gold {
    background: linear-gradient(135deg, #D4AF37 0%, #C5A028 100%);
    color: #070B1A;
    border: 1px solid #B89523;
    border-radius: 8px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(212, 175, 55, 0.25);
    transition: all 0.15s ease;
}
.btn-gold:hover {
    background: linear-gradient(135deg, #C5A028 0%, #B89523 100%);
    color: #070B1A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.35);
}

/* Layout Framework */
.crm-wrapper {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.crm-sidebar {
    width: var(--crm-sidebar-width);
    background-color: var(--crm-navy);
    color: #F8FAFC;
    height: 100vh;
    z-index: 1020;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}

.crm-main-content {
    flex-grow: 1;
    height: 100vh;
    background-color: var(--crm-slate-50);
}

/* Sidebar Elements */
.brand-link {
    letter-spacing: 0.05em;
}

.brand-icon-box {
    width: 36px;
    height: 36px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.brand-title {
    font-size: 0.95rem;
    line-height: 1.1;
    color: #FFFFFF;
}

.workspace-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tenant-dot {
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px #10B981;
}

.active-nav-link {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.08) 100%) !important;
    color: #FFFFFF !important;
    border-left: 3px solid var(--crm-gold);
    font-weight: 700 !important;
}

.hover-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
}

.nav-icon {
    width: 24px;
    text-align: center;
}

.text-xxs { font-size: 0.7rem; }
.text-xs { font-size: 0.8rem; }
.text-sm { font-size: 0.875rem; }
.pointer { cursor: pointer; }

/* Avatars */
.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.avatar-circle-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.avatar-circle-lg {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.telephony-pulse {
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Modals */
.modal-content {
    border-radius: 12px;
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #E2E8F0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--crm-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #F1F5F9;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}
