/* Projy Control Center — Custom Styles */

:root {
    --sidebar-w: 260px;
    --topbar-h: 56px;
    --color-primary: #1e40af;
    --color-primary-light: #3b82f6;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-muted: #6b7280;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: #1e293b;
    font-size: 14px;
    line-height: 1.5;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.2s ease;
}

.sidebar-logo {
    padding: 16px 20px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo h1 {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    letter-spacing: -0.3px;
}

.sidebar-logo .subtitle {
    font-size: 11px;
    color: #64748b;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #475569;
    padding: 12px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #1e293b;
    color: #f1f5f9;
}

.nav-item.active {
    background: #1e293b;
    color: #60a5fa;
    border-left-color: #3b82f6;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-client {
    padding: 10px 20px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.nav-client:hover { color: #e2e8f0; }

.nav-sub-items { padding-left: 16px; }

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.topbar-breadcrumb {
    font-size: 12px;
    color: var(--color-muted);
}

.topbar-spacer { flex: 1; }

.topbar-badges {
    display: flex;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-success { background: #f0fdf4; color: #16a34a; }
.badge-info { background: #eff6ff; color: #2563eb; }
.badge-neutral { background: #f1f5f9; color: #475569; }

.page-content {
    padding: 24px;
    max-width: 1400px;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

/* Metric cards */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
}

.metric-label {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.metric-sub {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-not_started { background: #f1f5f9; color: #64748b; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-complete { background: #dcfce7; color: #15803d; }
.status-blocked { background: #fef2f2; color: #dc2626; }
.status-pending { background: #fef9c3; color: #a16207; }
.status-sent { background: #dcfce7; color: #15803d; }
.status-draft { background: #f3e8ff; color: #7c3aed; }
.status-review { background: #fef3c7; color: #b45309; }
.status-approved { background: #dcfce7; color: #15803d; }

/* Client card (portfolio view) */
.client-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.client-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.client-card-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.client-card-type {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* Progress bar */
.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-fill-blue { background: #3b82f6; }
.progress-fill-green { background: #16a34a; }
.progress-fill-amber { background: #d97706; }
.progress-fill-red { background: #dc2626; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover { color: #0f172a; }

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.data-table tr:hover td { background: #f8fafc; }

.data-table .task-id {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--color-muted);
    white-space: nowrap;
}

/* Phase/workstream group header */
.group-header {
    background: #f1f5f9;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
}

.group-header:first-child { margin-top: 0; }

.group-header:hover { background: #e2e8f0; }

.group-chevron {
    transition: transform 0.2s;
    width: 14px;
    height: 14px;
}

.group-chevron.expanded { transform: rotate(90deg); }

.group-stats {
    margin-left: auto;
    display: flex;
    gap: 8px;
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
}

/* Alert banner */
.alert-banner {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.alert-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* View tabs */
.view-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.view-tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.view-tab:hover { color: #0f172a; }

.view-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Two column layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Section header */
.section-header {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Quick add bar */
.quick-add-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: border-color 0.15s;
}

.quick-add-bar:focus-within {
    border-color: var(--color-primary-light);
    border-style: solid;
}

.quick-add-bar input[type="text"] {
    flex: 1;
    border: none;
    font-size: 14px;
    padding: 6px 0;
    outline: none;
}

.quick-add-bar input[type="date"],
.quick-add-bar select {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.quick-add-btn {
    padding: 7px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.quick-add-btn:hover { background: #1e3a8a; }

/* RACI matrix */
.raci-cell {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.raci-R { background: #dbeafe; color: #1d4ed8; }
.raci-A { background: #1e40af; color: white; }
.raci-C { background: #f1f5f9; color: #64748b; }
.raci-I { background: #f8fafc; color: #94a3b8; }

/* Risk heat map */
.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.risk-low { background: #f0fdf4; color: #15803d; }
.risk-medium { background: #fef9c3; color: #a16207; }
.risk-high { background: #fef2f2; color: #dc2626; }
.risk-critical { background: #dc2626; color: white; }

/* Activity log timeline */
.activity-timeline {
    position: relative;
    padding-left: 24px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.activity-entry {
    position: relative;
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.activity-entry::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 20px;
    width: 10px;
    height: 10px;
    background: #3b82f6;
    border-radius: 50%;
    border: 2px solid white;
}

.activity-date {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.activity-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-top: 2px;
}

.activity-detail {
    font-size: 13px;
    color: #475569;
    margin-top: 8px;
}

.activity-detail strong {
    color: #0f172a;
}

/* Swimlane (workstream view) */
.swimlane-container {
    overflow-x: auto;
    padding: 20px 0;
}

.swimlane-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.swimlane-label {
    width: 200px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    text-align: right;
    padding-right: 8px;
}

.swimlane-bar-container {
    flex: 1;
    position: relative;
    height: 36px;
}

.swimlane-bar {
    position: absolute;
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: filter 0.15s;
}

.swimlane-bar:hover { filter: brightness(1.1); }

.swimlane-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 6px;
    opacity: 0.3;
}

.swimlane-week-markers {
    display: flex;
    position: relative;
    height: 24px;
    margin-top: 4px;
}

.swimlane-week-marker {
    flex: 1;
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    border-left: 1px solid #f1f5f9;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #0f172a;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    z-index: 100;
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hamburger (mobile) */
.hamburger {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #0f172a;
}

/* Channel icons */
.channel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 12px;
}

.channel-email { background: #dbeafe; color: #1d4ed8; }
.channel-sms { background: #dcfce7; color: #15803d; }
.channel-slack { background: #fae8ff; color: #9333ea; }
.channel-in-person { background: #fef3c7; color: #b45309; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: block;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
