/* ==========================================================================
   PIPELINE PWA - Modern Project Management CSS
   ========================================================================== */

:root {
    --bg-main: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --color-border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* App Layout Structure */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.app-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.brand-logo span.icon {
    font-size: 24px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}
.user-name {
    font-weight: 600;
    line-height: 1.2;
    font-size: 14px;
}
.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.app-body {
    display: flex;
    flex: 1;
}

/* Hamburger Button & Sidebar Overlay Defaults */
.hamburger-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    transition: background 0.2s ease;
}
.hamburger-btn:hover {
    background: #f3f4f6;
}

.sidebar-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.sidebar-close-btn {
    background: #f3f4f6;
    border: none;
    font-size: 18px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.sidebar-close-btn:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.app-sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid var(--color-border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    flex-shrink: 0;
}

/* Custom subtle scrollbar for sidebar */
.app-sidebar::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.app-sidebar::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}
.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

/* Main Content Area */
.app-main {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}

/* Page Titles */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none !important;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
}
.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: #d1d5db;
}
.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #b91c1c;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: #f9fafb;
}

/* Stats Cards (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}
.stat-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

/* Project Progress List */
.card-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.card-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}
.project-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: background 0.2s;
}
.project-item:hover {
    background: #f3f4f6;
    text-decoration: none;
}
.project-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.project-info p {
    font-size: 12px;
    color: var(--text-secondary);
}
.progress-bar-container {
    width: 140px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}
.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 32px;
}

/* ==========================================================================
   KANBAN BOARD PIPELINE STYLING
   ========================================================================== */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: calc(100vh - 220px);
    align-items: flex-start;
}

.kanban-column {
    background: #f1f5f9;
    border-radius: var(--radius-lg);
    width: 300px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
    border: 1px solid #e2e8f0;
}

.column-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}
.column-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #334155;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.column-count {
    background: #cbd5e1;
    color: #334155;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

.column-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
}

/* Task Cards */
.task-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}
.task-card:active {
    cursor: grabbing;
}
.task-card.sortable-ghost {
    opacity: 0.4;
    background: #e2e8f0;
    border: 2px dashed #94a3b8;
}
.task-card.sortable-drag {
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.task-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.task-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.task-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}
.task-due {
    color: var(--text-secondary);
    font-size: 11px;
}
.task-due.overdue {
    color: var(--color-danger);
    font-weight: 600;
}

/* Priority Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}
.badge-warning {
    background: #fffbeb;
    color: #d97706;
}
.badge-success {
    background: #f0fdf4;
    color: #16a34a;
}

/* Modals & Bottom Sheet */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-container {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transform: scale(0.94) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.modal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.modal-icon-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 22px;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}
.modal-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 3px 0 0 0;
}
.modal-close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close:hover {
    background: #e5e7eb;
    color: var(--text-primary);
    transform: rotate(90deg);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background-color: #f9fafb;
    box-sizing: border-box;
    transition: all 0.2s ease;
    color: var(--text-primary);
}
.form-control:focus {
    outline: none;
    background-color: #ffffff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.pipeline-preset-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 14px;
    margin-bottom: 20px;
}
.pipeline-preset-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pipeline-preset-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.pipeline-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}
.table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
}

/* PWA Mobile Bottom Navigation */
.mobile-nav {
    display: none;
}
