/* ═══════════════════════════════════════════════════════════════════
   Plano de Projeto -- Local Styles
   Uses shared/design-system.css tokens (--font-mono, --font-sans, etc.)
   Anti-patterns fixed: AP-001..AP-039
   ═══════════════════════════════════════════════════════════════════ */

/* ── Section accent (default green, changes per category via JS navigateTo) ── */
:root {
    --section-accent: var(--accent-success, #00E05A);
    --section-accent-rgb: 0, 224, 90;

    /* Category palette */
    --cat-projeto: #f59e0b;
    --cat-escopo: #3b82f6;
    --cat-pessoas: #8b5cf6;
    --cat-tempo: #06b6d4;
    --cat-riscos: #ec4899;
    --cat-relatorio: #10b981;
}

/* ── Base (defer to design-system.css, only override what's needed) ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-sans, 'Inter', -apple-system, sans-serif);
    background: var(--bg-primary, #050505);
    color: var(--text-primary, #fff);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Background image (KEEP) ── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('../img/bg.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(8px);
    z-index: -1;
    pointer-events: none;
}

/* Action buttons & Nav pills: inherited from shared/design-system.css (AP-018, AP-038) */
.btn-row { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); flex-wrap: wrap; }

/* ── Section Subtitles (AP-022: Tech Glow + Terminal Cursor) ── */
.section-subtitle {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--section-accent);
    text-shadow: 0 0 12px rgba(var(--section-accent-rgb), 0.4);
    animation: techGlow 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-subtitle::after {
    content: '|';
    animation: blink-cursor 1s step-end infinite;
    color: var(--section-accent);
    font-weight: 400;
}
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@keyframes techGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(var(--section-accent-rgb), 0.4); }
    50% { text-shadow: 0 0 25px rgba(var(--section-accent-rgb), 0.6), 0 0 35px rgba(var(--section-accent-rgb), 0.3); }
}

/* ── Tool Titles (section card headers) ── */
.tool-title {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--section-accent);
}
.tool-subtitle { font-size: 0.85rem; color: var(--text-secondary); }

/* ── Card ── */
.card {
    background: var(--bg-card, rgba(17,17,20,0.4));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}
.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}
.card-title {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--section-accent);
}
.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.card-title-line {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--section-accent);
    margin-bottom: var(--space-md);
}

/* ── Perspective Cards (Dashboard) ── */
.perspective-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: var(--space-xl);
}
.perspective-card {
    background: var(--bg-card, rgba(17,17,20,0.4));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    border-left: 3px solid var(--accent, var(--section-accent));
}
.perspective-card:hover { transform: translateY(-2px); border-color: var(--border-light); }
.perspective-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.perspective-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent, var(--section-accent));
    background: rgba(var(--accent-rgb, var(--section-accent-rgb)), 0.1);
}
.perspective-icon i { width: 16px; height: 16px; }
.perspective-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.perspective-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--accent, var(--section-accent));
}
.perspective-subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
}

/* ── Forms ── */
.form-group { margin-bottom: var(--space-lg); }
.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.4);
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-primary);
    font-family: var(--font-mono-alt);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--section-accent);
    box-shadow: 0 0 0 3px rgba(var(--section-accent-rgb), 0.15);
    background: rgba(255,255,255,0.06);
}
.form-textarea { min-height: 100px; resize: vertical; field-sizing: content; }
.form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* ── Objective Item Rows ── */
.objective-item,
.objectives-list .objective-item {
    display: grid;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-sm);
    margin-bottom: var(--space-xs);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    transition: all var(--transition-fast);
}
.objective-item:hover {
    background: rgba(var(--section-accent-rgb), 0.05);
    border-color: rgba(var(--section-accent-rgb), 0.25);
}

/* ── Status Badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-badge.risk-baixo { background: rgba(34,197,94,0.15); color: #86efac; }
.status-badge.risk-medio { background: rgba(245,158,11,0.15); color: #fde047; }
.status-badge.risk-alto  { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ── Gantt Table ── */
.gantt-container { overflow-x: auto; margin-bottom: var(--space-md); }
.gantt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}
.gantt-table th {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--section-accent);
    text-shadow: 0 0 12px rgba(var(--section-accent-rgb), 0.3);
    padding: 0.5rem;
    border-bottom: 1px solid rgba(var(--section-accent-rgb), 0.15);
    background: rgba(var(--section-accent-rgb), 0.03);
    white-space: nowrap;
}
.gantt-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono-alt);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.gantt-table tr:hover td { background: rgba(255,255,255,0.02); }
.gantt-cell { width: 30px; text-align: center; }
.gantt-cell.active {
    background: rgba(var(--section-accent-rgb), 0.2);
    border-left: 1px solid rgba(var(--section-accent-rgb), 0.3);
    border-right: 1px solid rgba(var(--section-accent-rgb), 0.3);
}

/* ── Drag & Drop + Resize Modular System ── */
.dash-module {
    position: relative;
    transition: box-shadow 0.2s;
    overflow: visible;
    min-height: fit-content;
}
.dash-module .drag-handle {
    position: absolute;
    top: 8px; left: 8px;
    cursor: grab;
    color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 2;
}
.dash-module:hover .drag-handle { color: rgba(255,255,255,0.35); }
.dash-module .drag-handle:hover {
    color: var(--section-accent);
    background: rgba(var(--section-accent-rgb), 0.1);
}
.dash-module .drag-handle:active { cursor: grabbing; }
.dash-module.dragging { opacity: 0.5; transform: scale(0.98); box-shadow: 0 0 0 2px rgba(var(--section-accent-rgb), 0.3); }
.dash-module.drag-over { box-shadow: 0 0 0 2px rgba(var(--section-accent-rgb), 0.5); transform: scale(1.01); }

/* Smart Grid container -- 12 cols, auto-place, no overlap */
.dash-modules-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    grid-auto-flow: dense;
    align-items: start;
}

/* Default col spans for this page */
.dash-module[data-module="project-summary"] { grid-column: span 12; }
.dash-module[data-module^="card-"]          { grid-column: span 3; }
.dash-module[data-module="actions"]         { grid-column: span 12; }

/* Reset layout button */
.reset-layout-btn {
    position: fixed;
    bottom: 1rem; right: 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 999;
    transition: all 0.15s;
}
.reset-layout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    border-color: rgba(255,255,255,0.15);
}

/* Resize handles */
.resize-handle {
    position: absolute;
    z-index: 3;
}
.resize-handle--right {
    top: 10%; bottom: 10%; right: -2px; width: 6px;
    cursor: col-resize;
    border-radius: 0 3px 3px 0;
    transition: background 0.15s;
}
.resize-handle--right:hover, .resize-handle--right.active {
    background: rgba(var(--section-accent-rgb), 0.3);
}
.dash-module.resizing {
    user-select: none;
    box-shadow: 0 0 0 1px rgba(var(--section-accent-rgb), 0.3);
}

/* ── Utilities ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.text-muted { color: var(--text-secondary); font-size: 0.85rem; }
.font-mono { font-family: var(--font-mono); font-size: 0.9em; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .dash-modules-container { grid-template-columns: repeat(4, 1fr); }
    .dash-module[data-module="project-summary"] { grid-column: span 4; }
    .dash-module[data-module^="card-"] { grid-column: span 4; }
    .dash-module[data-module="actions"] { grid-column: span 4; }
    .perspective-grid { grid-template-columns: 1fr; }
}
@media print {
    .nav-pills, .hero-actions, .btn-row, .global-topbar, .action-btn, .reset-layout-btn { display: none !important; }
    .page-dashboard { padding: 0; }
}
