/**
 * Wieser Petroleum Telecaller System - V2 Premium Stylesheet
 * Standardized with the Wieser ASM/SO Field Visit App design language
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --bg: hsl(220, 33%, 98%);
    --fg: hsl(222, 47%, 11%);
    --card: #ffffff;
    
    --primary: hsl(224, 64%, 33%);       /* Wieser Corporate Deep Blue */
    --primary-fg: #ffffff;
    --primary-glow: hsl(218, 90%, 56%);
    
    --accent: hsl(0, 74%, 50%);          /* Wieser Corporate Red */
    --accent-fg: #ffffff;
    
    --secondary: hsl(220, 14%, 96%);
    --muted-fg: hsl(220, 9%, 46%);
    --border: hsl(220, 13%, 91%);
    --destructive: hsl(0, 74%, 50%);
    
    --radius: 1rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1.5rem;
    
    /* Brand Gradients */
    --grad-brand: linear-gradient(135deg, hsl(224,64%,33%) 0%, hsl(258,60%,40%) 50%, hsl(0,74%,50%) 100%);
    --grad-hero: linear-gradient(135deg, hsl(224,70%,20%) 0%, hsl(224,64%,33%) 40%, hsl(0,74%,50%) 100%);
    
    /* Drop Shadows */
    --shadow-brand: 0 15px 45px -15px hsla(224,64%,33%,0.4);
    --shadow-card: 0 4px 24px -8px hsla(222,47%,11%,0.08);
    --shadow-hover: 0 12px 35px -10px hsla(222,47%,11%,0.15);
    
    /* Sidebar Styles */
    --sidebar-bg: hsl(222, 47%, 11%);
    --sidebar-fg: hsl(220, 14%, 96%);
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Typography Customization */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--fg);
}

.text-gradient-brand {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Header & Brand strip */
.brand-strip {
    height: 4px;
    background: var(--grad-brand);
    width: 100%;
}

.navbar-wieser {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
}

.navbar-wieser .navbar-brand {
    font-weight: 800;
    font-size: 1.15rem;
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

/* Connect logo styling components */
.wlogo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    text-decoration: none;
}
.wlogo .mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--grad-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    box-shadow: var(--shadow-brand);
}
.wlogo .name {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.02em;
    line-height: 1.1;
    text-align: left;
}
.wlogo .name small {
    display: block;
    font-weight: 500;
    font-size: 10px;
    color: var(--muted-fg);
    letter-spacing: .2em;
    text-transform: uppercase;
}
.connect {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.connect .ln {
    width: 6px;
    height: 2px;
    border-radius: 2px;
    background: #1E40AF;
}
.connect .ln.r {
    background: #F59E0B;
}
.connect .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.connect .tile {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,.15), 0 4px 10px rgba(0,0,0,.18);
}
.kbd {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted-fg);
}

.navbar-wieser .nav-link {
    color: var(--muted-fg) !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.navbar-wieser .nav-link:hover {
    color: var(--fg) !important;
}

/* Connect logo marker widget */
.wlogo-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--grad-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #white;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: var(--shadow-brand);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-wieser-primary {
    background: var(--grad-brand);
    color: white !important;
    border: none;
    box-shadow: var(--shadow-brand);
}

.btn-wieser-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 45px -10px hsla(224,64%,33%,0.5);
    opacity: 0.95;
}

.btn-wieser-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--fg);
}

.btn-wieser-outline:hover {
    background: var(--secondary);
    color: var(--fg);
    border-color: var(--border);
}

.btn-wieser-red {
    background: var(--accent);
    color: white !important;
    border: none;
}

.btn-wieser-red:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -10px hsla(0,74%,50%,0.4);
    opacity: 0.95;
}

/* Inputs & Form styling */
.form-control, .form-select {
    height: 2.75rem;
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-size: 0.875rem;
    background: white;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsla(224,64%,33%,0.12);
    color: var(--fg);
}

textarea.form-control {
    height: auto;
    padding: 0.75rem;
}

.form-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
}

/* Lead Cards in Queue */
.card-lead {
    border-left: 5px solid var(--muted-fg);
    margin-bottom: 12px;
    cursor: pointer;
}

.card-lead:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Lead priorities */
.card-lead.priority-hot { border-left-color: var(--accent); }
.card-lead.priority-warm { border-left-color: var(--primary); }
.card-lead.priority-cold { border-left-color: var(--muted-fg); }

/* Overdue and Urgent warning outlines */
.card-lead.sla-overdue {
    border: 1.5px solid var(--accent);
    border-left: 6px solid var(--accent);
    background-color: hsla(0, 74%, 50%, 0.015);
}

.card-lead.sla-warning {
    border: 1.5px solid #ffc107;
    border-left: 6px solid #ffc107;
    background-color: hsla(45, 100%, 50%, 0.015);
}

/* Badges / Pills */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-overdue {
    background-color: hsla(0, 74%, 50%, 0.1);
    color: var(--accent);
}

.badge-warning {
    background-color: hsla(45, 100%, 50%, 0.15);
    color: #856404;
}

.badge-normal {
    background-color: hsla(224, 64%, 33%, 0.1);
    color: var(--primary);
}

/* Admin Sidebar Console */
.admin-sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-fg);
    padding: 1.5rem 1rem;
    border-radius: var(--radius) 0 0 var(--radius);
    min-height: 100vh;
}

.admin-sidebar .brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: white;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-sidebar .nav-link-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: hsla(220, 14%, 96%, 0.7);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.admin-sidebar .nav-link-item:hover {
    background-color: hsla(220, 14%, 96%, 0.08);
    color: white;
}

.admin-sidebar .nav-link-item.active {
    background: var(--grad-brand);
    color: white;
    box-shadow: var(--shadow-brand);
}

/* Stat Metrics Dashboard Box */
.stat-card {
    border-top: none;
    border: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    background: hsla(224, 64%, 33%, 0.1);
    color: var(--primary);
}

.red-metric .stat-icon {
    background: hsla(0, 74%, 50%, 0.1);
    color: var(--accent);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--fg);
    margin-top: 0.25rem;
}

/* Custom Funnel V2 - Vertical Flowchart */
.funnel-container {
    padding: 0.5rem 0;
}
.funnel-v2 {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.funnel-step {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    gap: 14px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s;
}
.funnel-step:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.funnel-step-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.funnel-step-details {
    flex: 1;
}
.funnel-step-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--fg);
}
.funnel-step-count {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
}
.funnel-step-rate {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--fg);
    min-width: 50px;
    text-align: right;
    background: var(--secondary);
    padding: 4px 8px;
    border-radius: 8px;
}
.funnel-dropoff {
    display: flex;
    justify-content: center;
    margin: -2px 0;
    position: relative;
    z-index: 2;
    height: 24px;
}
.funnel-dropoff::before {
    content: '';
    position: absolute;
    top: -12px;
    bottom: -12px;
    left: 50%;
    width: 2px;
    border-left: 2px dashed var(--border);
    z-index: -1;
    transform: translateX(-50%);
}
.funnel-dropoff-pill {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--destructive);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: var(--shadow-card);
    align-self: center;
}

/* Modern Audit Trail Timeline */
.timeline-item {
    border-left: 2px solid var(--border);
    padding-left: 1.25rem;
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    position: absolute;
    left: -6px;
    top: 6px;
    box-shadow: 0 0 0 3px white;
}

.timeline-item.outcome-converted::before {
    background-color: #198754;
}

.timeline-item.outcome-not-interested::before {
    background-color: var(--accent);
}

/* Flow locks working layouts */
.lock-banner {
    background: var(--grad-hero);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-brand);
}

body.lead-locked-mode {
    background-color: #f0f2f5;
}

/* Table Style custom */
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-fg);
    background-color: var(--secondary) !important;
    padding: 4px 8px !important;
    font-weight: 700;
    border-bottom: 1px solid var(--border) !important;
}

.table td {
    padding: 2px 8px !important;
    font-size: 0.875rem;
    line-height: 1.25 !important;
    border-bottom: 1px solid var(--border) !important;
}

/* PWA App Install Banner Styling */
#pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--grad-hero);
    color: white;
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1050;
    display: none; /* Flex-toggle managed by JS prompt */
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

#pwa-install-banner strong {
    color: #ffffff !important;
}

#pwa-install-banner small {
    color: rgba(255, 255, 255, 0.75) !important;
}

@media (max-width: 575px) {
    #pwa-install-banner {
        flex-direction: column;
        align-items: stretch;
        bottom: 10px;
        left: 10px;
        right: 10px;
        border-radius: 12px;
        padding: 12px;
        gap: 10px;
        text-align: center;
    }
    #pwa-install-banner .d-flex {
        justify-content: center;
    }
}
