/* ═══════════════════════════════════════════════════════════════════
   Planejamento Estrategico — Styles
   Uses design-system.css tokens (--font-mono, --font-sans, etc.)
   Anti-patterns fixed: AP-001, AP-002, AP-014, AP-016, AP-018, AP-038
   ═══════════════════════════════════════════════════════════════════ */

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

    /* Category palette */
    --cat-dados: #f59e0b;
    --cat-estrategia: #8b5cf6;
    --cat-ambiente: #06b6d4;
    --cat-financas: #22c55e;
    --cat-clientes: #3b82f6;
    --cat-processos: #ec4899;
    --cat-aprendizado: #eab308;
}

/* ── 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;
}

.page-dashboard { padding: var(--space-xl) 2.5rem; padding-top: calc(42px + var(--space-xl)); max-width: 1400px; margin: 0 auto; }
.hidden { display: none !important; }

/* ── Hero ── */
.hero {
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--space-md);
}
.hero-brand {
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--section-accent);
    letter-spacing: 2px;
    margin-bottom: var(--space-xs);
}
.hero-subtitle {
    font-family: var(--font-mono-alt, 'Space Mono', monospace);
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    letter-spacing: 1px;
}
.hero-actions { display: flex; gap: var(--space-sm); }

/* 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; }

/* ── Category Header Line ── */
.category-header-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--space-md);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.category-header-line i { width: 18px; height: 18px; opacity: 0.8; }
.category-header-line h2 {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

/* ── Perspective Cards Grid ── */
.perspective-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 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;
    height: 100%;
}
.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; }
.perspective-icon i { width: 16px; height: 16px; }
.perspective-count { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; }
.perspective-title { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; margin-bottom: var(--space-xs); padding-left: 10px; border-left: 3px solid rgba(255,255,255,0.15); }
.perspective-subtitle { font-size: 0.75rem; color: rgba(255,255,255,0.35); margin-bottom: 0.75rem; }

/* Perspective color accents */
.perspective-card.financas { border-left: 3px solid var(--cat-financas); }
.perspective-card.financas .perspective-icon { color: var(--cat-financas); background: rgba(34,197,94,0.1); }
.perspective-card.financas .perspective-count { color: #86efac; }
.perspective-card.financas .perspective-title { color: var(--cat-financas); border-left-color: var(--cat-financas); }

.perspective-card.clientes { border-left: 3px solid var(--cat-clientes); }
.perspective-card.clientes .perspective-icon { color: var(--cat-clientes); background: rgba(59,130,246,0.1); }
.perspective-card.clientes .perspective-count { color: #93c5fd; }
.perspective-card.clientes .perspective-title { color: var(--cat-clientes); border-left-color: var(--cat-clientes); }

.perspective-card.processos { border-left: 3px solid var(--cat-processos); }
.perspective-card.processos .perspective-icon { color: var(--cat-processos); background: rgba(236,72,153,0.1); }
.perspective-card.processos .perspective-count { color: #f9a8d4; }
.perspective-card.processos .perspective-title { color: var(--cat-processos); border-left-color: var(--cat-processos); }

.perspective-card.aprendizado { border-left: 3px solid var(--cat-aprendizado); }
.perspective-card.aprendizado .perspective-icon { color: var(--cat-aprendizado); background: rgba(234,179,8,0.1); }
.perspective-card.aprendizado .perspective-count { color: #fde047; }
.perspective-card.aprendizado .perspective-title { color: var(--cat-aprendizado); border-left-color: var(--cat-aprendizado); }

/* ── Progress Bar ── */
.progress-bar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

/* ── 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-title-line {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: var(--space-md);
}
.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); }

/* ── Chart ── */
.chart-container { max-height: 400px; position: relative; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono-alt, 'Space Mono', monospace);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-fast);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: rgba(var(--section-accent-rgb), 0.4);
    box-shadow: 0 0 0 3px rgba(var(--section-accent-rgb), 0.08);
}
.form-textarea { resize: vertical; min-height: 60px; field-sizing: content; }
.form-input-sm { padding: 6px 10px; font-size: 0.8rem; }

/* Date picker icon */
.form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* ── Objectives List ── */
.objectives-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.objective-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-md);
    align-items: start;
    padding: var(--space-md);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 12px);
    transition: all var(--transition-fast);
}
.objective-item:hover {
    border-color: var(--border-light);
    background: rgba(var(--section-accent-rgb), 0.03);
}

/* ── Action Items ── */
.actions-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.action-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}
.action-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.action-row {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-md);
}
.action-main { flex: 1; }
.action-details {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.action-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.action-field label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.action-progress { margin-top: var(--space-sm); }

/* Progress bar colors by perspective */
.section-financas .progress-fill,
.section-financas .action-progress .progress-fill { background: var(--cat-financas); }
.section-clientes .progress-fill,
.section-clientes .action-progress .progress-fill { background: var(--cat-clientes); }
.section-processos .progress-fill,
.section-processos .action-progress .progress-fill { background: var(--cat-processos); }
.section-aprendizado .progress-fill,
.section-aprendizado .action-progress .progress-fill { background: var(--cat-aprendizado); }

/* ── SWOT Scope Grid ── */
.swot-scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}
.swot-scope-card {
    background: rgba(17,17,20,0.5);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}
.swot-scope-card:hover { border-color: var(--border-light); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.swot-scope-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}
.swot-scope-title { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.swot-scope-count { font-size: 0.75rem; color: var(--text-muted); background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: var(--radius-sm); }
.swot-item-list { display: flex; flex-direction: column; gap: var(--space-sm); min-height: 50px; }
.swot-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}
.swot-item:hover { border-color: var(--border-light); }
.swot-item-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    min-height: 24px;
    font-family: var(--font-mono-alt);
}
.swot-item-type { display: flex; gap: 4px; }
.swot-type-btn {
    width: 24px; height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.swot-type-btn.strength { color: #22c55e; border-color: rgba(34,197,94,0.25); }
.swot-type-btn.strength.active { background: #22c55e; color: white; box-shadow: 0 0 10px rgba(34,197,94,0.5); }
.swot-type-btn.weakness { color: #ef4444; border-color: rgba(239,68,68,0.25); }
.swot-type-btn.weakness.active { background: #ef4444; color: white; box-shadow: 0 0 10px rgba(239,68,68,0.5); }
.swot-type-btn.opportunity { color: #3b82f6; border-color: rgba(59,130,246,0.25); }
.swot-type-btn.opportunity.active { background: #3b82f6; color: white; box-shadow: 0 0 10px rgba(59,130,246,0.5); }
.swot-type-btn.threat { color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.swot-type-btn.threat.active { background: #f59e0b; color: white; box-shadow: 0 0 10px rgba(245,158,11,0.5); }
.swot-item-remove {
    width: 20px; height: 20px; border-radius: 50%; border: none;
    background: transparent; color: var(--text-muted); cursor: pointer;
    font-size: 0.75rem; transition: all var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.swot-item-remove:hover { background: rgba(239,68,68,0.2); color: #ef4444; }
.swot-add-btn {
    width: 100%; padding: var(--space-sm); margin-top: var(--space-sm);
    background: transparent; border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-size: 0.8rem; cursor: pointer; transition: all var(--transition-fast);
}
.swot-add-btn:hover { border-color: var(--section-accent); color: var(--section-accent); background: rgba(var(--section-accent-rgb),0.05); }

/* ── Section Subtitles (Tech Glow + Terminal Cursor) ── */
.section-subtitle {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--section-accent);
    text-shadow: 0 0 12px rgba(var(--section-accent-rgb), 0.4);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    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;
    opacity: 0.7;
}
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── 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;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    cursor: grab;
    color: rgba(255,255,255,0.1);
    border-radius: 4px;
    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 columns */
.dash-modules-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    grid-auto-rows: minmax(60px, auto);
    position: relative;
}

/* Default col spans */
.dash-module[data-module="company-info"]       { grid-column: span 12; }
.dash-module[data-module^="persp-"]            { grid-column: span 3; }
.dash-module[data-module="summary-chart"]      { grid-column: span 12; }

/* Reset layout button */
.reset-layout-btn {
    position: absolute;
    top: -32px; right: 0;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 2;
}
.reset-layout-btn:hover { color: rgba(255,69,58,0.7); border-color: rgba(255,69,58,0.2); }

/* Resize handles */
.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 3;
    transition: background 0.15s;
}
.resize-handle:hover, .resize-handle.active { background: rgba(var(--section-accent-rgb),0.3); }
.resize-handle--right { top: 0; right: 0; width: 5px; height: 100%; cursor: ew-resize; }
.resize-handle--corner { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.resize-handle--corner::after {
    content: '';
    position: absolute;
    bottom: 3px; right: 3px;
    width: 8px; height: 8px;
    border-right: 2px solid rgba(255,255,255,0.1);
    border-bottom: 2px solid rgba(255,255,255,0.1);
    transition: border-color 0.15s;
}
.dash-module:hover .resize-handle--corner::after { border-color: rgba(255,255,255,0.25); }
.resize-handle--corner:hover::after, .resize-handle--corner.active::after { border-color: var(--section-accent); }
.dash-module.resizing { user-select: none; box-shadow: 0 0 0 1px rgba(var(--section-accent-rgb),0.3); }

/* ── Button overrides (keep inline with design-system) ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.6);
    font-family: var(--font-mono);
    transition: all var(--transition-fast);
}
.btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.7rem; }
.btn-icon { padding: 0.4rem; min-width: 28px; }
.btn-secondary { background: transparent; border: 1px solid var(--border-color); color: rgba(255,255,255,0.5); }

/* ── Flex utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.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; }
.text-center { text-align: center; }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .action-details { grid-template-columns: repeat(3, 1fr); }
    .objective-item { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .page-dashboard { padding: var(--space-md); padding-top: calc(42px + var(--space-md)); }
    .hero { flex-direction: column; align-items: flex-start; }
    .perspective-grid { grid-template-columns: 1fr; }
    .action-details { grid-template-columns: repeat(2, 1fr); }
    .objective-item { grid-template-columns: 1fr; }
    .dash-modules-container { grid-template-columns: 1fr; }
    .dash-module[data-module^="persp-"] { grid-column: span 1; }
    .dash-module[data-module="company-info"],
    .dash-module[data-module="summary-chart"] { grid-column: span 1; }
}

/* ── Print ── */
@media print {
    .nav-pills, .hero-actions, .btn-row, .global-topbar, .action-btn { display: none !important; }
    .page-dashboard { padding: 0; }
    body { background: #fff; color: #000; }
    .card { background: #fff; border: 1px solid #ddd; }
}
