/*
  ============================================================================
  PROPRIETÁRIO: Mauricio Spark
  MARCA:        Spark Mauricio
  PROJETO:      ForestFlow
  VERSÃO:       v1.0.0
  LINHAGEM:     SPARK
  ============================================================================
  Documento de Planejamento de Escopo
  COPYRIGHT: © 2026 / Mauricio Spark. Todos os direitos reservados.
  ============================================================================
*/

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    min-height: 100vh;
    color: #f1f5f9;
    overflow: hidden;
}

header {
    background: #1e293b;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid #334155;
    height: 64px;
}

header h1 {
    color: #f1f5f9;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

header p {
    color: #94a3b8;
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.2;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

header > div:first-child {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header > div:first-child > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #334155;
    color: #f1f5f9;
    border: 1px solid #475569;
}

.btn:hover {
    background: #475569;
    transform: translateY(-1px);
}

.btn-primary {
    background: #3b82f6;
    color: #f1f5f9;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-icon {
    padding: 0.625rem;
    border-radius: 8px;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-section select {
    padding: 0.625rem 1rem;
    border: 1px solid #475569;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #1e293b;
    color: #f1f5f9;
    min-width: 180px;
    cursor: pointer;
}

.filter-section select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tree-container {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: #0f172a;
    cursor: grab;
}

.tree-container:active {
    cursor: grabbing;
}

.tree-canvas {
    position: absolute;
    transform-origin: 0 0;
    transition: transform 0.1s ease-out;
}

.family-tree {
    position: relative;
    min-width: max-content;
    min-height: max-content;
    padding: 100px;
}

.svg-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    fill: none;
    stroke: #475569;
    stroke-width: 2;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.connection-line.highlighted {
    stroke: #3b82f6;
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
}

.connection-line.dimmed {
    stroke: #334155;
    opacity: 0.3;
}

.marriage-line {
    fill: none;
    stroke: #4a90d9;
    stroke-width: 3;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.marriage-line.divorced {
    stroke: #ef4444;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

.generation {
    display: flex;
    justify-content: center;
    gap: 40px;
    position: relative;
    margin-bottom: 80px;
}

.generation:last-child {
    margin-bottom: 0;
}

.member-node {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.25rem;
    min-width: 160px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.member-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: #475569;
}

.member-node.male {
    border-left: 3px solid #3b82f6;
}

.member-node.female {
    border-left: 3px solid #ec4899;
}

.member-node.highlighted {
    background: #1e293b;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.member-node.lineage-interrupted {
    border-left-color: #ef4444;
}

.lineage-warning {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #f1f5f9;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.member-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.25rem;
}

.member-years {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.member-surnames {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
}

.surname-tag {
    background: #334155;
    color: #cbd5e1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.surname-tag:hover {
    background: #475569;
}

.surname-tag.highlighted {
    background: #3b82f6;
    color: #f1f5f9;
}

.surname-tag.lost {
    background: #450a0a;
    color: #fca5a5;
}

.surname-tag.transmitted {
    background: #052e16;
    color: #86efac;
}

.zoom-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #1e293b;
    color: #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    font-size: 1.25rem;
    border: 1px solid #334155;
}

.zoom-btn:hover {
    background: #334155;
    transform: scale(1.05);
}

.details-panel {
    position: fixed;
    right: -400px;
    top: 64px;
    width: 400px;
    height: calc(100vh - 64px);
    background: #1e293b;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
    padding: 2rem;
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 999;
    border-left: 1px solid #334155;
}

.details-panel.visible {
    right: 0;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #334155;
    color: #cbd5e1;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

.details-panel h2 {
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
}

.panel-section h3 {
    color: #cbd5e1;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.panel-section p {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.surname-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.surname-tags .surname-tag {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
}

.date-tag {
    background: #334155;
    color: #cbd5e1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.empty-state p {
    color: #94a3b8;
    font-size: 1.125rem;
    max-width: 600px;
    line-height: 1.6;
}

.relationship-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.relationship-actions .btn {
    flex: 1;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.relationship-item {
    background: #334155;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 3px solid #4a90d9;
}

.relationship-item p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.relationship-item strong {
    color: #f1f5f9;
}

.relationship-date {
    color: #94a3b8;
    font-size: 0.8rem;
}

.relationship-status {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.relationship-surname {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-style: italic;
}

.no-relationships {
    color: #94a3b8;
    font-size: 0.875rem;
    font-style: italic;
}

.registration-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1e293b;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    border: 1px solid #334155;
}

.registration-form.visible {
    display: block;
}

.registration-form h2 {
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #cbd5e1;
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #475569;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #0f172a;
    color: #f1f5f9;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.hidden {
    display: none !important;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
}

.overlay.visible {
    display: block;
}

.lineage-status-alert {
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
}

.lineage-status-alert.interrupted {
    background: #450a0a;
    color: #fca5a5;
    border-left: 4px solid #ef4444;
}

.lineage-status-alert.continued {
    background: #052e16;
    color: #86efac;
    border-left: 4px solid #22c55e;
}

.lineage-status-alert.unknown {
    background: #431407;
    color: #fdba74;
    border-left: 4px solid #f97316;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .details-panel {
        width: 100%;
        right: -100%;
    }
    
    .generation {
        flex-direction: column;
        align-items: center;
    }
}
