/* PipelinePro Design System Stylesheet */

/* --- Design Tokens --- */
:root {
    /* Color Palette */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-active: #3730A3;
    --secondary: #06B6D4;
    --secondary-hover: #0891B2;
    --tertiary: #F97316;
    --tertiary-hover: #EA580C;
    --background: #FAFAFA;
    --surface: #FFFFFF;
    
    /* Semantic Colors */
    --success: #22C55E;
    --success-bg: #F0FDF4;
    --success-border: #BBF7D0;
    --success-text: #16A34A;
    
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --warning-border: #FDE68A;
    --warning-text: #D97706;
    
    --error: #EF4444;
    --error-bg: #FEF2F2;
    --error-border: #FECACA;
    --error-text: #DC2626;
    
    --info: #4F46E5;
    
    /* Neutrals / Grays */
    --gray-50: #FAFAFA;
    --gray-100: #F4F4F5;
    --gray-200: #E4E4E7;
    --gray-300: #D4D4D8;
    --gray-400: #A1A1AA;
    --gray-500: #71717A;
    --gray-600: #52525B;
    --gray-700: #3F3F46;
    --gray-800: #27272A;
    --gray-900: #18181B;

    /* Typography Fonts */
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Source Code Pro', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Spacing Scale (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Border Radii */
    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows & Elevation */
    --shadow-subtle: 0 1px 2px rgba(24, 24, 27, 0.05);
    --shadow-medium: 0 4px 6px -1px rgba(24, 24, 27, 0.07), 0 2px 4px -2px rgba(24, 24, 27, 0.05);
    --shadow-large: 0 10px 15px -3px rgba(24, 24, 27, 0.08), 0 4px 6px -4px rgba(24, 24, 27, 0.04);
    --shadow-overlay: 0 20px 25px -5px rgba(24, 24, 27, 0.12), 0 8px 10px -6px rgba(24, 24, 27, 0.06);
    --shadow-drag: 0 12px 24px -4px rgba(79, 70, 229, 0.15);
}

/* --- Base Layout resets --- */
body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--gray-900);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

h1, .h2 {
    font-size: 38px;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

h3, .h3 {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.3;
}

.text-mono, code, pre {
    font-family: var(--font-mono) !important;
    font-size: 14px;
}

a {
    color: var(--secondary);
    transition: color 0.15s ease-in-out;
}
a:hover {
    color: var(--secondary-hover);
}

/* --- Bootstrap Overrides --- */

/* App Header */
header.navbar.sticky-top.bg-dark {
    background-color: var(--gray-900) !important;
    border-bottom: 1px solid var(--gray-800);
    box-shadow: var(--shadow-subtle) !important;
}
.navbar-brand {
    font-family: var(--font-display) !important;
    font-weight: 800 !important;
    font-size: 1.25rem !important;
    color: #ffffff !important;
    background-color: transparent !important;
    box-shadow: none !important;
    letter-spacing: -0.02em;
}
header.navbar .nav-link {
    color: var(--gray-400) !important;
    font-weight: 500;
}
header.navbar .nav-link:hover {
    color: #ffffff !important;
}

/* Sidebar */
#sidebarMenu.sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid var(--gray-200);
    box-shadow: none !important;
    padding-top: 56px !important;
}
.sidebar-sticky {
    height: calc(100vh - 56px) !important;
}
#sidebarMenu .nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-600);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    margin: 2px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease-in-out;
}
#sidebarMenu .nav-link i {
    font-size: 16px;
    color: var(--gray-400);
    transition: color 0.15s ease-in-out;
}
#sidebarMenu .nav-link:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
}
#sidebarMenu .nav-link:hover i {
    color: var(--gray-700);
}
#sidebarMenu .nav-link.active {
    background-color: #EEF2FF;
    color: var(--primary);
    font-weight: 600;
}
#sidebarMenu .nav-link.active i {
    color: var(--primary);
}
.sidebar-heading {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--gray-400) !important;
    padding: 16px 26px 8px !important;
}

/* Buttons styling matching specs */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-md);
    padding: 8px 18px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    height: 32px;
    padding: 4px 12px;
    font-size: 13px;
}

.btn-lg {
    height: 46px;
    padding: 12px 24px;
    font-size: 16px;
}

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

/* Primary Filled */
.btn-primary {
    background-color: var(--primary) !important;
    border: none !important;
    color: #ffffff !important;
}
.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    box-shadow: var(--shadow-subtle);
}
.btn-primary:active {
    background-color: var(--primary-active) !important;
}

/* Secondary Outline */
.btn-outline-primary {
    background-color: transparent !important;
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
}
.btn-outline-primary:hover {
    background-color: #EEF2FF !important;
    color: var(--primary) !important;
}

/* Secondary/Outline variant for other border buttons */
.btn-outline-secondary {
    background-color: transparent !important;
    border: 1px solid var(--gray-300) !important;
    color: var(--gray-600) !important;
}
.btn-outline-secondary:hover {
    background-color: var(--gray-100) !important;
    border-color: var(--gray-400) !important;
    color: var(--gray-900) !important;
}

/* Ghost Button styling */
.btn-ghost {
    background-color: transparent !important;
    border: none !important;
    color: var(--gray-500) !important;
}
.btn-ghost:hover {
    background-color: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

/* Destructive Button */
.btn-danger, .btn-destructive {
    background-color: var(--error) !important;
    border: none !important;
    color: #ffffff !important;
}
.btn-danger:hover, .btn-destructive:hover {
    background-color: #DC2626 !important;
}
.btn-outline-danger {
    background-color: transparent !important;
    border: 1px solid var(--error) !important;
    color: var(--error) !important;
}
.btn-outline-danger:hover {
    background-color: var(--error-bg) !important;
    color: var(--error) !important;
}

.btn:disabled, .btn.disabled {
    opacity: 0.40 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Cards styling matching specs */
.card {
    background-color: var(--surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    border-color: var(--gray-300);
}

.card-header {
    background-color: var(--gray-50) !important;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 16px;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.card-body {
    padding: 16px;
}

/* Elevated Cards */
.card-elevated {
    box-shadow: var(--shadow-medium);
}
.card-elevated:hover {
    box-shadow: var(--shadow-large);
    transform: translateY(-2px);
}

/* Form Inputs styling matching specs */
.form-label {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-control, .form-select {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--gray-900);
    background-color: var(--surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    height: 38px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    outline: none;
    color: var(--gray-900);
    background-color: var(--surface);
}

.form-control:disabled, .form-select:disabled {
    background-color: var(--background);
    opacity: 0.5;
    cursor: not-allowed;
}

.form-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.invalid-feedback {
    font-size: 12px;
    color: var(--error);
}
.is-invalid {
    border-color: var(--error) !important;
}
.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* Checkboxes and Radios */
.form-check-input {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    margin-top: 0.2em;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    border-color: var(--primary);
}

.form-check-input[type="radio"] {
    border-radius: var(--radius-full);
}

.form-check-label {
    font-family: var(--font-body);
    font-size: 14px;
    padding-left: 8px;
    cursor: pointer;
}

.form-check-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.form-check-input:disabled ~ .form-check-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tables styling matching specs */
.table {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--gray-800);
    vertical-align: middle;
}
.table > :not(caption) > * > * {
    padding: 12px 16px;
}
.table th, .table td {
    border-radius: var(--radius-none) !important; /* Table cells: no radius */
}
.table thead, .table-light {
    background-color: var(--gray-100) !important;
    color: var(--gray-700);
}
.table thead th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}
.table-hover tbody tr:hover {
    background-color: var(--gray-50) !important;
}

/* Badges / Chips */
.badge {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-sm); /* Default tag radius */
}
.rounded-pill {
    border-radius: var(--radius-full) !important;
}

/* Filter Chip */
.filter-chip {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 13px;
    color: var(--gray-600);
    background-color: transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}
.filter-chip:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
}
.filter-chip.active, .filter-chip.selected {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* Status Chips */
.status-chip {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
/* won / success */
.status-chip.status-won, .status-chip.bg-success, .badge.bg-success {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
    border-color: var(--success-border) !important;
}
/* at risk / warning */
.status-chip.status-at-risk, .status-chip.bg-warning, .badge.bg-warning {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    border-color: var(--warning-border) !important;
}
/* lost / error / cancelled */
.status-chip.status-lost, .status-chip.bg-danger, .badge.bg-danger {
    background-color: var(--error-bg) !important;
    color: var(--error-text) !important;
    border-color: var(--error-border) !important;
}
/* new / secondary */
.status-chip.status-new, .status-chip.bg-secondary, .badge.bg-secondary {
    background-color: var(--gray-100) !important;
    color: var(--gray-700) !important;
    border-color: var(--gray-200) !important;
}
/* active project / primary info */
.status-chip.status-in-progress, .status-chip.bg-primary, .badge.bg-primary, .badge.bg-info {
    background-color: #EEF2FF !important;
    color: var(--primary) !important;
    border-color: #C7D2FE !important;
}

/* Lists styling matching specs */
.list-group-item {
    font-family: var(--font-body);
    font-size: 14px;
    padding: 10px 12px;
    border-color: var(--gray-100) !important;
    transition: background-color 0.15s ease;
}
.list-group-item:hover {
    background-color: var(--gray-50);
}
.list-group-item.active {
    background-color: #EEF2FF !important;
    color: var(--primary) !important;
    border-left: 2px solid var(--primary) !important;
    font-weight: 600;
}

/* Tooltips styling matching specs */
.tooltip-custom {
    background-color: var(--gray-900);
    color: var(--gray-50);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    max-width: 240px;
}

/* Proton Tabs styling refinements to match new system */
.app-tab-container {
    background-color: var(--gray-100) !important;
    border-bottom: 1px solid var(--gray-200) !important;
}
.app-tab {
    font-family: var(--font-body) !important;
    color: var(--gray-500) !important;
}
.app-tab.active {
    background-color: var(--background) !important;
    color: var(--primary) !important;
}
.app-tab.active::before {
    background-color: var(--primary) !important;
}
.app-tab-close:hover {
    background-color: var(--error) !important;
}

/* --- Kanban / Pipeline Board Layout --- */
.pipeline-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 4px 16px 4px;
    min-height: calc(100vh - 220px);
    align-items: flex-start;
}

.pipeline-column {
    flex: 1;
    min-width: 280px;
    max-width: 360px;
    background-color: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
    box-shadow: var(--shadow-subtle);
}

.pipeline-column-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pipeline-column-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.pipeline-column-title .badge {
    font-size: 11px;
    padding: 2px 6px;
}

.pipeline-column-meta {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

/* Pipeline Stage Specific Colors */
.pipeline-column.stage-new { border-top: 4px solid var(--gray-400); }
.pipeline-column.stage-in_progress { border-top: 4px solid var(--primary); }
.pipeline-column.stage-completed { border-top: 4px solid var(--success); }
.pipeline-column.stage-cancelled { border-top: 4px solid var(--error); }

.pipeline-cards-list {
    padding: 12px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background-color 0.2s ease;
}

.pipeline-cards-list.drag-over {
    background-color: rgba(79, 70, 229, 0.04);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Deal Card in Pipeline */
.deal-card {
    background-color: var(--surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-subtle);
    cursor: grab;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    user-select: none;
}

.deal-card:hover {
    box-shadow: var(--shadow-medium);
    border-color: var(--gray-300);
}

.deal-card:active {
    cursor: grabbing;
}

.deal-card.dragging {
    opacity: 0.45;
    transform: scale(0.96);
    box-shadow: var(--shadow-drag);
    border: 1px dashed var(--primary);
    background-color: rgba(79, 70, 229, 0.05);
}

/* Card stage visual indicator */
.deal-card.card-stage-new { border-left: 4px solid var(--gray-400); }
.deal-card.card-stage-in_progress { border-left: 4px solid var(--primary); }
.deal-card.card-stage-completed { border-left: 4px solid var(--success); }
.deal-card.card-stage-cancelled { border-left: 4px solid var(--error); }

.deal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.deal-card-number {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
}

.deal-card-client {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.deal-card-client:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.deal-card-desc {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--gray-600);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.deal-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--gray-100);
    padding-top: 8px;
    margin-top: 4px;
}

.deal-card-value {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary); /* cyan / secondary accent for deal value */
}

.deal-card-tech {
    font-size: 11px;
    color: var(--gray-500);
    background-color: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.deal-card:hover .deal-card-actions {
    opacity: 1;
}

.deal-card-actions .btn {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 11px;
    border-radius: var(--radius-sm);
}

/* --- View toggles container --- */
.view-toggle-container {
    background-color: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 2px;
    display: inline-flex;
    gap: 2px;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn.active {
    background-color: #ffffff;
    color: var(--primary);
    box-shadow: var(--shadow-subtle);
}

/* --- Modern Login Card overrides --- */
.login-body {
    background-color: var(--background) !important;
}
.login-card {
    background: var(--surface) !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-large) !important;
    padding: 32px !important;
}
.login-header h1 {
    font-family: var(--font-display) !important;
    font-weight: 800 !important;
    font-size: 2.25rem !important;
    color: var(--primary) !important;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}
.login-header p {
    font-size: 14px;
    color: var(--gray-500);
}
