

/* ============================================= */
/* ==  REILINK "LINK" HELP SYSTEM STYLES  == */
/* ============================================= */

/* --- 1. General Help System --- */
.link-help-trigger {
    cursor: help;
    border-bottom: 1px dotted var(--color-text-secondary); /* Use existing CSS var */
    position: relative;
}

.link-help-icon {
    cursor: help;
    color: var(--color-text-tertiary); /* Use existing CSS var */
    font-size: 14px;
    margin-left: 8px;
    transition: color 0.2s ease-in-out;
}

.link-help-icon:hover {
    color: var(--color-accent); /* Use existing CSS var */
}


/* --- 2. Intelligent Tooltip Container --- */
#link-tooltip-container {
    /* Core Styling */
    position: fixed;
    z-index: 9999;
    width: 420px;
    background-color: #1e293b; /* slate-800 */
    color: #f1f5f9; /* slate-100 */
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    line-height: 1.6;

    /* Visibility & Animation */
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}

#link-tooltip-container.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Arrow */
#link-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
}

#link-tooltip-arrow.arrow-down {
    bottom: -8px;
    border-top: 8px solid #1e293b;
}

#link-tooltip-arrow.arrow-up {
    top: -8px;
    border-bottom: 8px solid #1e293b;
}


/* Tooltip Content Styling */
#link-tooltip-header {
    padding: 12px 16px;
    border-bottom: 1px solid #334155; /* slate-700 */
    font-weight: 700;
    font-size: 15px;
    color: #e0f2fe; /* sky-200 */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#link-tooltip-close-btn {
    background: none;
    border: none;
    color: #94a3b8; /* slate-400 */
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

#link-tooltip-close-btn:hover {
    color: #fff;
}

#link-tooltip-body {
    padding: 16px;
}

#link-tooltip-body p {
    margin: 0;
}

#link-tooltip-body p:not(:last-child) {
    margin-bottom: 12px;
}

#link-tooltip-body strong {
    color: #7dd3fc; /* sky-300 */
    font-weight: 600;
}

#link-tooltip-body .dynamic-value {
    background-color: #334155; /* slate-700 */
    color: #f59e0b; /* amber-500 */
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-family: monospace;
}


/* --- 3. Slide-Out Tutorial Panel --- */
#link-slideout-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Lower z-index */
    visibility: hidden;
    pointer-events: none;
}

#link-slideout-container.visible { visibility: visible; pointer-events: auto; }

#link-slideout-overlay { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(30, 41, 59, 0.6); 
    opacity: 0; 
    transition: opacity 0.3s ease-in-out; 
    z-index: 6; 
}
#link-slideout-container.visible #link-slideout-overlay { opacity: 1; }

#link-slideout-panel {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 7;
}

/* Animation Logic */
#link-slideout-panel.from-right { right: 0; width: 35%; transform: translateX(100%); box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2); }
#link-slideout-panel.from-left { left: 0; width: 40%; transform: translateX(-100%); box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2); }
#link-slideout-panel.active { transform: translateX(0); }
 
/* --- DEFAULT (RIGHT TO LEFT) --- */
#link-slideout-panel {
    /* Starting position for RIGHT panel */
    transform: translateX(90%);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* The final position is now set by JS, so this rule is no longer needed! */
/*
#link-slideout-container:not(.slide-from-left).visible #link-slideout-panel {
    transform: translateX(-137%);
}
*/

/* --- LEFT TO RIGHT VARIANT --- */
#link-slideout-container.slide-from-left #link-slideout-panel {
    /* Starting position for LEFT panel */
    transform: translateX(-90%);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2);
}


/* Slide-out Content Styling */
#link-slideout-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}
#link-slideout-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}
#link-slideout-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-medium);
    cursor: pointer;
    transition: color 0.2s;
}
#link-slideout-close-btn:hover {
    color: var(--text-dark);
}

#link-slideout-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}
#link-slideout-body h4 {
    font-size: 1.5px;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--reilink-primary-dark);
}
#link-slideout-body p {
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 11px;
}

/* Screencapture Styles */
.link-screencap {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background-color: var(--reilink-bg-subtle);
    padding: 1rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.05);
    overflow: hidden;
}

.edit-repairs-help{
    margin-top: -8.5%;
    font-size: 16px;
    margin-left: -4%;
}


#rhp-panel {
    background-color: #fff;
    color: #1e2d3b;
    display: flex;
    flex-direction: column;
    max-width: 0;
    overflow-x: hidden; /* Hide content during the animation */
    transition: max-width 0.5s cubic-bezier(0.65, 0, 0.35, 1);
    border-left: 0px solid #e0e0e0;
}

/* When the container is active, expand the panel */
#rhp-panel.active {
    max-width: 519.58px; 
    border-left-width: 1px;
}

#rhp-panel header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    min-width: 519.58px;
}

#rhp-panel h3 {
    margin: 0;
    font-size: 15px !important;
    white-space: nowrap;
    font-weight: 600;
}

#rhp-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #9ca3af;
}

#rhp-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-size: 14px;
    min-width: 519.58px;
}

#link-tooltip-body .formula-block { 
    background-color: #334155; 
    padding: 12px; 
    border-radius: 6px; 
    margin-top: 16px; 
}
#link-tooltip-body .formula { 
    font-family: 'Courier New', Courier, monospace; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.75rem; 
    white-space: nowrap; 
}
.formula .result { color: #f59e0b; }
.formula-fraction { display: inline-flex; flex-direction: column; text-align: center; }
.formula .numerator, .formula .denominator { padding: 4px 8px; }
.formula .denominator { border-top: 1px solid #94a3b8; }
.formula .operator { font-size: 1.5rem; color: #94a3b8; }

.link-pro-tip-icon {
    color: var(--color-accent);
    font-size: 16px;
    cursor: help;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

#link-manuals-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--color-accent);
    color: white;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
    z-index: 100;
}
#link-manuals-button:hover {
    transform: scale(1.1);
}


/* --- NEW: RHP Panel System --- */

/* Make the main container the positioning context */
#contract-listing .page-container {
  position: relative;
}

#contract-listing .column {
    position: relative;
    z-index: 1; 
}

/* Shared styles for both panels */
.rhp-panel {
    position: absolute;
    top: 0;
    height: 100vh;
    background-color: #ffffff;
    z-index: 1000; 
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 25px rgba(0,0,0,0.2);

    /* Animate the clip-path property for a smooth "unveiling" effect */
    transition: clip-path 0.45s cubic-bezier(0.4, 0, 0.2, 1);

    /* Start with the panel non-interactive */
    pointer-events: none;
}

.rhp-panel.active {
    /* Make the panel interactive only when it's active */
    pointer-events: auto;
}

/* --- Left Panel Specifics --- */
#rhp-panel-left {
    left: 0;
    width: 50%;
    /* HIDDEN STATE: The panel is clipped to be 0 width, anchored to its right side */
    clip-path: inset(0 0 0 100%); 
}
#rhp-panel-left.active {
    /* ACTIVE STATE: The clip is removed, revealing the panel from right-to-left */
    clip-path: inset(0 0 0 0);
}

/* --- Right Panel Specifics --- */
#rhp-panel-right {
    right: 0;
    width: 35%;
    /* HIDDEN STATE: The panel is clipped to be 0 width, anchored to its left side */
    clip-path: inset(0 100% 0 0);
}
#rhp-panel-right.active {
    /* ACTIVE STATE: The clip is removed, revealing the panel from left-to-right */
    clip-path: inset(0 0 0 0);
}
/* --- NEW: Modern RHP Panel Content Styling --- */

/* 1. Panel Header: Better alignment and aesthetics */
.rhp-panel header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg-dark); /* Subtle background for the header */
}

.rhp-panel .rhp-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* 2. Close Button: Correctly positioned and styled */
.rhp-panel .rhp-close-btn {
    background-color: transparent;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.rhp-panel .rhp-close-btn:hover {
    background-color: var(--color-border);
    color: var(--color-text-primary);
}

/* 3. Panel Body: Improved typography and spacing */
.rhp-panel .rhp-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem; /* Increased padding for better readability */
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.rhp-panel .rhp-body h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.rhp-panel .rhp-body p {
    margin-bottom: 1rem;
}

.rhp-panel .rhp-body strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* 4. Screencap Element: A more refined look */
.rhp-panel .link-screencap {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    background-color: var(--color-bg-dark);
    padding: 1rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.04);
}