/* ========================================
   CRM Automation System - Custom CSS
   ======================================== */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* ========================================
   Sidebar Styles
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: white;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.page-content {
    padding: 2rem 1.5rem;
}

/* ========================================
   Cards and Statistics
   ======================================== */
.stat-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

/* ========================================
   Table Styles
   ======================================== */
.table-custom {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    overflow: hidden;
}

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

.table-custom .table thead th {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
    color: #5a5c69;
    padding: 1rem;
}

.table-custom .table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* ========================================
   Status Badges
   ======================================== */
.status-new {
    background-color: #0d6efd;
    color: white;
}

.status-review {
    background-color: #ffc107;
    color: #000;
}

.status-documents {
    background-color: #0dcaf0;
    color: #000;
}

.status-approved {
    background-color: #198754;
    color: white;
}

.status-rejected {
    background-color: #dc3545;
    color: white;
}

.status-completed {
    background-color: #6f42c1;
    color: white;
}

.status-pending {
    background-color: #ffc107;
    color: #000;
}

/* ========================================
   Notification Panel
   ======================================== */
.notification-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 350px;
    max-height: 400px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

/* ========================================
   Role-specific Sidebar Colors
   ======================================== */
.role-admin .sidebar {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.role-sales .sidebar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.role-broker .sidebar {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
}

.role-borrower .sidebar {
    background: linear-gradient(135deg, #48dbfb 0%, #0abde3 100%);
}

.role-director .sidebar {
    background: linear-gradient(135deg, #1dd1a1 0%, #10ac84 100%);
}

/* ========================================
   Custom Scrollbar
   ======================================== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .notification-panel {
        width: calc(100vw - 40px);
        right: 20px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-xs {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* ========================================
   Animation Classes
   ======================================== */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================
   Card Hover Effects
   ======================================== */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2) !important;
}

/* ========================================
   Button Enhancements
   ======================================== */
.btn {
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.98);
}

/* ========================================
   Form Enhancements
   ======================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ========================================
   Table Actions
   ======================================== */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========================================
   Loading States
   ======================================== */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {

    .sidebar,
    .topbar,
    .btn,
    .notification-panel {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}