/* Global Styles */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2c3e50;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --gray: #95a5a6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Layout */
.container-fluid {
    padding: 0;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(135deg, var(--secondary) 0%, #1a252f 100%);
    color: white;
    min-height: 100vh;
    padding: 20px 0;
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    transition: all 0.3s;
    z-index: 1000;
}

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

.sidebar-header h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.7;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--primary);
}

.sidebar-nav li a i {
    width: 25px;
    margin-right: 10px;
    font-size: 1.1rem;
}

/* Main Content — top-nav layout, no sidebar */
.main-content {
    margin-left: 0;
    padding: 20px;
    min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: none;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success) 0%, #219a52 100%);
    color: white;
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #e67e22 100%);
    color: white;
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
    color: white;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    float: right;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    background: white;
    border-collapse: collapse;
}

.table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--secondary);
    border-bottom: 2px solid #dee2e6;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

/* ============================================
   TOP NAVIGATION BAR STYLES
   ============================================ */

/* ── TOP NAV: always visible on front-end CRM pages ── */
.top-nav {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 9999;
    display: block !important;
    visibility: visible !important;
    width: 100%;
}
.top-nav .navbar {
    padding: 0.5rem 1rem;
}
.top-nav .navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: #2c3e50;
    text-decoration: none;
}
.top-nav .navbar-brand i {
    color: #3498db;
    margin-right: 8px;
}
.top-nav .nav-link {
    color: #2c3e50;
    font-weight: 500;
    padding: 0.8rem 1rem;
    transition: all 0.3s;
    text-decoration: none;
}
.top-nav .nav-link:hover,
.top-nav .nav-link.active {
    color: #3498db;
    background: #f8f9fa;
}
.top-nav .nav-link i {
    margin-right: 6px;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Main Content Adjustment — intentionally 0, sidebar not used on front-end */
/* .main-content margin-left already set to 0 above */

/* Hide Sidebar when using top nav */
.sidebar {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .top-nav .navbar-brand {
        font-size: 1rem;
    }
    
    .top-nav .nav-link {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
}