/**
 * Softinsan Connect - Modern SaaS Design System & Stylesheet
 */

:root {
    --brand-primary: #3b82f6;
    --brand-primary-hover: #2563eb;
    --brand-dark: #0f172a;
    --brand-surface: #1e293b;
    --brand-surface-card: #1e293b;
    --brand-border: #334155;
    --brand-text: #f8fafc;
    --brand-text-muted: #94a3b8;
    --brand-accent: #6366f1;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --brand-danger: #ef4444;
    --sidebar-width: 260px;
    --topbar-height: 68px;
}

[data-bs-theme="dark"] body {
    background-color: var(--brand-dark);
    color: var(--brand-text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

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

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: #111827;
    border-right: 1px solid var(--brand-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--brand-border);
    text-decoration: none;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.25rem;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    transition: all 0.2s;
}

.nav-link-custom:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link-custom.active {
    color: #ffffff;
    background: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.nav-link-custom .badge {
    margin-left: auto;
}

/* Main Content Area */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.app-topbar {
    height: var(--topbar-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--brand-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

/* Impersonation Banner */
.impersonation-banner {
    background: linear-gradient(90deg, #b45309 0%, #d97706 100%);
    color: #ffffff;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1050;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Content Viewport */
.app-content {
    padding: 1.5rem;
    flex: 1;
}

/* Glassmorphic & Modern Cards */
.card-saas {
    background: var(--brand-surface-card);
    border: 1px solid var(--brand-border);
    border-radius: 0.875rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-saas:hover {
    border-color: #475569;
}

.stat-card {
    padding: 1.25rem;
    border-radius: 0.875rem;
    background: var(--brand-surface-card);
    border: 1px solid var(--brand-border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-primary);
}

.stat-card.stat-success::before { background: var(--brand-success); }
.stat-card.stat-warning::before { background: var(--brand-warning); }
.stat-card.stat-danger::before { background: var(--brand-danger); }
.stat-card.stat-accent::before { background: var(--brand-accent); }

/* Live Timer Ticker Pill */
.timer-pill {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

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

/* Status Badges */
.badge-status {
    padding: 0.35rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.badge-assigned { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-in_progress { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.badge-on_hold { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-under_review { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.badge-rework_required { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-completed { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-cancelled { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }

/* Tables */
.table-saas {
    --bs-table-bg: transparent;
    --bs-table-color: var(--brand-text);
    --bs-table-border-color: var(--brand-border);
}

.table-saas th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--brand-border);
}

.table-saas td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--brand-border);
}

.table-saas tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-content-saas {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Progress bar styling */
.progress-saas {
    height: 8px;
    background-color: #334155;
    border-radius: 1rem;
    overflow: hidden;
}

/* Responsive sidebar */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1035;
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }
}
