/* ==========================================================================
   1. GLOBAL RENDER RESETS & SaaS DESIGN CORE TOKENS
   ========================================================================== */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Master Platform Container Matrix Framework */
.master-viewport-wrapper, .master-breakout-frame {
    width: 100% !important;
    max-width: 1540px !important;
    margin: 0 auto !important;
    padding: 0 20px 20px 20px !important;
    box-sizing: border-box !important;
}

.full-width {
    width: 100%;
    box-sizing: border-box;
}

/* Standard Visual Display Card Block */
.card {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
}

.card h2 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 700;
}

.card p {
    margin: 0 0 10px 0;
    color: #64748b;
    font-size: 14px;
}

/* Form Controls & Global Component Buttons */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #475569;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    box-sizing: border-box;
    color: #1e293b;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

.btn {
    display: inline-block;
    background-color: #2980b9;
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
    box-sizing: border-box;
    text-align: center;
}

.btn:hover {
    background-color: #1f6391;
}

/* Alert Notification Components */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
}

.alert.success {
    background-color: #dcfce7;
    color: #14532d;
    border-left-color: #22c55e;
}

.alert.error {
    background-color: #fee2e2;
    color: #7f1d1d;
    border-left-color: #ef4444;
}

/* ==========================================================================
   2. HERD DIRECTORY PANEL ACCORDION DROPDOWN FILTERS
   ========================================================================== */
.dropdown-filter-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    box-sizing: border-box;
}

.filter-row-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    position: relative;
}

.filter-dropdown-node {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    position: relative;
}

.filter-dropdown-btn {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: #ffffff;
    border: none;
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-dropdown-btn:hover {
    background: #f1f5f9;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: none;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 4px 4px;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.filter-dropdown-content.open {
    display: flex;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #334155;
    cursor: pointer;
}

.filter-item input {
    margin: 0;
    cursor: pointer;
}

/* ==========================================================================
   3. ALIGNMENT-LOCKED ANIMAL DIRECTORY TABLE
   ========================================================================== */
.directory-matrix-wrapper-container {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.sorting-header-row-expanded {
    display: flex !important;
    background: transparent;
    padding: 10px 12px !important;
    border-bottom: 2px solid #cbd5e1;
    font-size: 12px;
    font-weight: bold;
    color: #334155;
    margin-bottom: 8px;
    align-items: center;
    box-sizing: border-box !important;
    width: 100% !important;
}

.dir-link-item-expanded {
    display: flex !important;
    padding: 10px 12px !important;
    text-decoration: none;
    color: #334155;
    font-size: 13px;
    align-items: center;
    box-sizing: border-box !important;
    width: 100% !important;
}

.directory-list-node {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f1f5f9;
}

.directory-list-node:hover {
    background-color: #f8fafc;
}

.directory-list-node.active-row-highlight {
    background-color: #e8f4fd;
}

.directory-list-node.active-row-highlight .dir-text-meta {
    color: #2980b9;
    font-weight: bold;
}

/* Segment Percentage Allocators Secure Perfect Horizontal Balance */
.col-segment-tag { width: 44% !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; display: inline-block; padding-right: 5px; box-sizing: border-box; }
.col-segment-sex { width: 16% !important; text-align: left; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; }
.col-segment-age { width: 24% !important; text-align: left; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; }
.col-segment-status { width: 16% !important; text-align: left; display: inline-block; box-sizing: border-box; }

.dir-text-meta {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}

.sort-clickable-btn {
    cursor: pointer;
    user-select: none;
}

.sort-clickable-btn:hover {
    color: #2980b9;
    text-decoration: underline;
}

.sort-icon-marker {
    font-size: 10px;
    margin-left: 2px;
    color: #27ae60;
    font-weight: bold;
    display: inline-block;
}

.dir-badge-meta {
    display: inline-block;
    margin: 0;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 3px;
}

/* ==========================================================================
   4. PROFILE DATA WORKSPACE FILTERS & PANEL SWITCHES
   ========================================================================== */
.view-toggle-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border-left: 4px solid #27ae60;
    align-items: center;
    box-sizing: border-box;
    width: 100% !important;
}

.view-toggle-title {
    font-size: 12px;
    font-weight: bold;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 3px;
}

.toggle-switch-lbl {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #1e293b;
    font-weight: bold;
    cursor: pointer;
    background: #f1f5f9;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    user-select: none;
    transition: all 0.2s ease;
}

.toggle-switch-lbl:hover {
    background: #e2e8f0;
}

.toggle-switch-lbl input {
    cursor: pointer;
    margin: 0;
}

.toggle-switch-lbl.checked-active {
    background: #e8f4fd;
    color: #2980b9;
    border-color: #93c5fd;
}

/* Historical Feed Row Filter Controls */
.filter-widget-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.filter-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
}

.filter-checkbox-item input {
    cursor: pointer;
    margin: 0;
}

/* Inline Actions Styles for Historical Table Management */
.action-btn-inline { background: none; border: none; cursor: pointer; font-size: 13px; font-weight: bold; padding: 2px 6px; border-radius: 4px; display: inline-flex; align-items: center; text-decoration: none; }
.btn-edit-inline { color: #2980b9; }
.btn-edit-inline:hover { background: #e8f4fd; color: #1f6391; }
.btn-delete-inline { color: #c0392b; margin-left: 8px; }
.btn-delete-inline:hover { background: #fde8e8; color: #962d22; }

/* Inline Edit Field Rows Wrapper Configuration */
.edit-form-row { background: #fffcf5 !important; }
.edit-inline-input { padding: 6px 10px; border: 1px solid #dca842; border-radius: 4px; font-size: 13px; outline: none; background: #fff; }
.btn-save-inline { background: #27ae60; color: #fff; border: none; border-radius: 4px; padding: 5px 10px; font-size: 12px; font-weight: bold; cursor: pointer; }
.btn-save-inline:hover { background: #219653; }
.btn-cancel-inline { background: #7f8c8d; color: #fff; border: none; border-radius: 4px; padding: 5px 10px; font-size: 12px; font-weight: bold; cursor: pointer; margin-left: 5px; }
.btn-cancel-inline:hover { background: #6c7a7d; }
/* ==========================================================================
   5. GRAPHICAL PEDIGREE VECTOR CANVAS STYLING
   ========================================================================== */
.ancestry-canvas-card { background: #ffffff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); margin-bottom: 20px; box-sizing: border-box; border: 1px solid #e2e8f0; width: 100% !important; overflow: hidden; }
.svg-viewport-wrapper { width: 100%; overflow-x: auto; overflow-y: hidden; background: #fafafa; border: 1px solid #e2e8f0; border-radius: 6px; padding: 15px; box-sizing: border-box; }
.pedigree-svg { display: block; margin: 0 auto; max-width: 100%; height: auto; user-select: none; }

/* Vector Connection Lines & Node Shapes */
.tree-connector-line { fill: none !important; stroke: #cbd5e1 !important; stroke-width: 2px !important; }
.node-g { cursor: pointer; transition: transform 0.15s ease; }
.node-g:hover { transform: translate(0, -2px) scale(1.02); }
.node-g rect { stroke: #cbd5e1; transition: all 0.2s ease; }

.node-sire:hover rect { stroke: #2980b9; fill: #f0f7fc; }
.node-dam:hover rect { stroke: #e74c3c; fill: #fdf2f2; }

/* SVG Tree Typography */
.node-text-gen { font-size: 9px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.3px; }
.node-text-tag { font-size: 12px; font-weight: bold; fill: #1e293b; }
.node-text-name { font-size: 11px; font-style: italic; fill: #64748b; }
.gen-sire-lbl { fill: #2980b9; }
.gen-dam-lbl { fill: #e74c3c; }

/* Data Entry Form Row Alignment Grid */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; width: 100%; box-sizing: border-box; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }