/* ==========================================================================
   1. GLOBAL ENGINE & TYPE RESETS
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Global Link Anchors */
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   2. VIEWPORT CONDITIONAL CONTEXTS (BODY CLASSES)
   ========================================================================== */

/* Context A: The Login / Forgot Password Entry Gateways */
body.gateway-viewport {
    background: #618c47 url("/assets/images/leaves_2000x1600.jpg") no-repeat top right;
    color: #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* Context B: The Dynamic Multi-Tenant Dashboard / Canvas Panels */
body.cockpit-body {
    background: #618c47 url("/assets/images/leaves_2000x1600.jpg") no-repeat top right;
    /*background-color: #618c47; */
    color: #212529;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Header_nav */
/* Navigation Component Styles */
.main-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.nav-brand a {
    color: #1a1e21;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.nav-brand .v2-badge {
    font-size: 0.75rem;
    background: #ffffff;
    color: #1a1e21;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #adb5bd;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link.active {
    color: #1a1e21;
}

.nav-link:hover {
    color: #1a1e21;
}

.search-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.search-input {
    background: #ffffff;
    border: 1px solid #495057;
    border-radius: 4px 0 0 4px;
    padding: 6px 12px;
    color: #2b3035;
    font-size: 0.85rem;
    width: 220px;
    outline: none;
}

.search-button {
    background: #ffffff;
    border: 1px solid #495057;
    border-left: none;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
}

.logout-btn {
    text-decoration: none;
    background-color: #dc3545;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* ==========================================================================
   3. AUTHENTICATION GATEWAY CARD ARCHITECTURE
   ========================================================================== */
.gateway-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    padding: 35px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.gateway-header {
    text-align: center;
    margin-bottom: 25px;
}

.gateway-header h1 {
    font-size: 1.5rem;
    color: #212529;
    margin: 0 0 5px 0;
    font-weight: 700;
}

.gateway-header p {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
}

/* Component Form Controls */
.gateway-card .form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.gateway-card .form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.gateway-card .form-control {
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #ffffff;
    width: 100%;
    min-height: 44px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gateway-card .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

/* Submission Interfaces */
.gateway-card .btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: bold;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-height: 44px;
    margin-top: 10px;
    transition: background-color 0.15s ease;
}

.gateway-card .btn-submit:hover {
    background-color: #0069d9;
}

/* Contextual Notifications */
.gateway-card .alert {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.gateway-card .alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gateway-card .alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gateway-card .meta-links {
    margin-top: 25px;
    text-align: center;
    font-size: 0.85rem;
}

.gateway-card .meta-links a {
    margin: 0 8px;
}

/* ==========================================================================
   4. COCKPIT DASHBOARD GRID ARCHITECTURE
   ========================================================================== */
.dashboard-container {
    max-width: 1200px;
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
    flex: 1 0 auto; /* Keeps footer pushed down on empty layouts */
}

.welcome-bar {
    background: #ffffff;
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.welcome-meta h1 {
    margin: 0 0 5px 0;
    font-size: 1.8rem;
    color: #212529;
}

.welcome-meta p {
    margin: 0;
    color: #6c757d;
    font-size: 0.95rem;
}

/* Flex layout workspace grid container */
.workspace-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
}

.info-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.info-card h3 {
    margin: 0 0 15px 0;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 10px;
    color: #495057;
    font-size: 1.15rem;
}

/* Multi-tenant relational profile parameters */
.meta-table {
    width: 100%;
    border-collapse: collapse;
}

.meta-table td {
    padding: 12px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #f8f9fa;
}

.meta-table tr:last-child td {
    border-bottom: none;
}

.meta-label {
    font-weight: 600;
    color: #6c757d;
    width: 40%;
}

.meta-value {
    font-family: monospace;
    color: #212529;
    font-size: 0.95rem;
}


/* Container for the tree - make it spacious */
.tree-container {
    padding: 40px;
    background: #fdfdfd;
    overflow-x: auto;
    white-space: nowrap;
}

/* Base node */
.limb-node {
    display: flex;
    align-items: center;
    position: relative;
    margin: 10px 0;
}

/* The box for the person */
.node-box {
    padding: 10px 15px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #fff;
    min-width: 140px;
    z-index: 2;
}

/* The wrapper for children (Father/Mother) */
.limb-children {
    display: flex;
    flex-direction: column;
    margin-left: 40px; /* Space for the line */
    position: relative;
}

/* Drawing the horizontal line */
.limb-children::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    width: 20px;
    border-top: 2px solid #888;
}

/* Draw a vertical line to connect Father and Mother */
.limb-children > .limb-node:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    bottom: -10px;
    border-left: 2px solid #888;
}
.family-chart { display: flex; flex-direction: column; align-items: center; }
.row { display: flex; gap: 10px; margin: 20px 0; position: relative; }
.node { 
    padding: 10px; border: 2px solid #333; border-radius: 4px; background: #fff; 
    position: relative; 
}
/* Draw a vertical line from the row above */
.row::before {
    content: ''; position: absolute; top: -20px; left: 50%; height: 20px;
    border-left: 2px solid #333;
}
#cy { 
    display: block !important; 
    visibility: visible !important; 
    min-height: 600px !important; 
    border: 5px solid red !important; /* This red border will confirm the container is actually on the page */
}

/* ==========================================================================
   5. RESPONSIVE LAYOUT RESPONSES
   ========================================================================== */
@media (max-width: 850px) {
    .workspace-grid {
        grid-template-columns: 1fr; /* Stack columns on tablets and mobile screens */
        gap: 20px;
    }
}