/* 
   TechGenics CRM - Modern Agency Management UI
   Design System: Clean Light Mode, Glass Accents, Vibrant Indicators
*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #4338ca;
    --primary-light: #6366f1;
    --primary-soft: #eef2ff;
    --primary-hover: #3730a3;
    
    --secondary: #64748b;
    --secondary-soft: #f1f5f9;
    
    --success: #059669;
    --success-soft: #ecfdf5;
    
    --warning: #d97706;
    --warning-soft: #fffbeb;
    
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    
    --orange: #ea580c;
    --orange-soft: #fff7ed;
    
    --info: #0284c7;
    --info-soft: #f0f9ff;
    
    --purple: #7c3aed;
    --purple-soft: #f5f3ff;
    
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    --sidebar-bg: #0f172a;
    --sidebar-color: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-color: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-heading: #1e293b;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --sidebar-width: 260px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    font-size: 0.925rem;
    line-height: 1.5;
    overflow-x: hidden;
}

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

#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--body-bg);
}

.content-body {
    padding: 1.5rem 2rem;
    flex-grow: 1;
}

/* Sidebar Styling */
.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-heading {
    font-size: 0.685rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #475569;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    color: var(--sidebar-color);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.885rem;
}

.sidebar-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.2s ease;
}

.sidebar-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link:hover i {
    color: var(--primary-light);
}

.sidebar-item.active .sidebar-link {
    background: linear-gradient(90deg, #4338ca 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.3);
}

.sidebar-item.active .sidebar-link i {
    color: #ffffff;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
}

/* Top Navbar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin: 0;
}

/* Modern Metric Cards */
.metric-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.25s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.metric-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0;
}

.metric-icon-box {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.metric-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-heading);
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.metric-sub {
    font-size: 0.775rem;
    margin-top: 0.4rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Metric Colors */
.metric-primary .metric-icon-box { background: var(--primary-soft); color: var(--primary); }
.metric-success .metric-icon-box { background: var(--success-soft); color: var(--success); }
.metric-warning .metric-icon-box { background: var(--warning-soft); color: var(--warning); }
.metric-danger .metric-icon-box { background: var(--danger-soft); color: var(--danger); }
.metric-info .metric-icon-box { background: var(--info-soft); color: var(--info); }
.metric-purple .metric-icon-box { background: var(--purple-soft); color: var(--purple); }
.metric-orange .metric-icon-box { background: var(--orange-soft); color: var(--orange); }

/* Renewal Alert Cards & Traffic Light Badges */
.bg-orange { background-color: var(--orange) !important; }
.text-orange { color: var(--orange) !important; }

.renewal-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    height: 100%;
}

.renewal-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.renewal-item {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
}

.renewal-item:last-child {
    border-bottom: none;
}

.renewal-item:hover {
    background-color: #f8fafc;
}

.pulse-badge {
    animation: badgePulse 2s infinite ease-in-out;
}

@keyframes badgePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Modern Card Containers */
.app-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

.app-card-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.app-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-card-body {
    padding: 1.5rem;
}

/* Custom Table Styles */
.table-custom {
    margin-bottom: 0;
    width: 100% !important;
}

.table-custom thead th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 0.95rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.885rem;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges & Pills */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* Action Buttons */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    transition: all 0.2s ease;
}

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

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

.btn-soft-primary {
    background-color: var(--primary-soft);
    color: var(--primary);
    border: none;
}
.btn-soft-primary:hover {
    background-color: var(--primary);
    color: #fff;
}

/* Quick Avatars */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 54px; height: 54px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.75rem; }

/* Timeline Component */
.activity-timeline {
    position: relative;
    padding-left: 2rem;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 9px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modals */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    border-bottom: 1px solid var(--card-border);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
    }
    
    #sidebar.show {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(2px);
        z-index: 1030;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .content-body {
        padding: 1rem;
    }
}
