/* ============================================
   PHARMDATA DESIGN SYSTEM - APEX THEME
   Oracle APEX 24ai Universal Theme Integration

   Version: 1.0.0
   Last Updated: December 2024
   ============================================ */

/* ================================================
   1. DESIGN TOKENS (Source of Truth)
   ================================================ */

:root {
    /* ========== INSTITUTIONAL COLORS ========== */
    --emerald-abyss: #0B2D2A;
    --graphite-depth: #1F2937;
    --soft-steel: #374151;
    --teal-intense: #1a8b7d;
    --arctic-mist: #E9ECEF;
    --cloud: #F5F8FA;
    --soft-arctic: #E5E8EB;
    --mint-signal: #B7E4D5;

    /* ========== SEMANTIC COLORS ========== */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #E65100;
    --warning-light: #FFF3E0;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* ========== SHADOWS ========== */
    --shadow-xs: 0 1px 3px 0 rgba(11, 45, 42, 0.12);
    --shadow-sm: 0 2px 6px -1px rgba(11, 45, 42, 0.15);
    --shadow-md: 0 4px 12px -2px rgba(11, 45, 42, 0.18);
    --shadow-lg: 0 10px 24px -4px rgba(11, 45, 42, 0.22);

    /* ================================================
       2. APEX UNIVERSAL THEME VARIABLE MAPPING
       ================================================ */

    /* Primary Palette */
    --ut-palette-primary: var(--teal-intense);
    --ut-palette-primary-contrast: #ffffff;
    --ut-palette-primary-shade: var(--emerald-abyss);

    /* Body */
    --ut-body-background-color: var(--cloud);
    --ut-body-text-color: var(--graphite-depth);

    /* Headings */
    --ut-heading-text-color: var(--emerald-abyss);
    --ut-body-title-text-color: var(--emerald-abyss);

    /* Regions */
    --ut-region-background-color: #ffffff;
    --ut-region-header-background-color: transparent;
    --ut-region-border-color: var(--soft-arctic);

    /* Components */
    --ut-component-background-color: #ffffff;
    --ut-component-border-color: var(--soft-arctic);
    --ut-component-border-radius: 8px;

    /* Links */
    --ut-link-text-color: var(--teal-intense);
    --ut-link-text-color-hover: var(--emerald-abyss);

    /* Buttons */
    --a-button-background-color: var(--teal-intense);
    --a-button-text-color: #ffffff;
    --a-button-hover-background-color: var(--emerald-abyss);
    --a-button-border-radius: 8px;

    /* Tables */
    --ut-table-header-background-color: var(--arctic-mist);
    --ut-table-header-text-color: var(--soft-steel);
    --ut-table-row-hover-background-color: rgba(183, 228, 213, 0.08);

    /* Navigation */
    --ut-nav-list-background-color: var(--emerald-abyss);
    --ut-nav-list-text-color: #ffffff;
    --ut-nav-list-text-color-hover: var(--mint-signal);

    /* Typography */
    --a-base-font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ut-heading-font-family: 'EB Garamond', Georgia, serif;
    --a-code-font-family: 'IBM Plex Mono', 'Courier New', monospace;
}


/* ================================================
   3. APEX COMPONENT OVERRIDES
   ================================================ */

/* ----- Header (Barra Superior) ----- */
.t-Header {
    background: var(--cloud) !important;
    border-bottom: 1px solid var(--soft-arctic);
    min-height: 56px;
    padding: 0.5rem 0;
    box-shadow: 0 1px 3px rgba(11, 45, 42, 0.08);
}

.t-Header-branding-container,
.t-Header-nav,
.t-Header-controls {
    min-height: 48px;
}

/* ----- Breadcrumb Area (.t-Body-title) ----- */
.t-Body-title {
    background: var(--arctic-mist) !important;
    border-bottom: 1px solid var(--soft-arctic);
    padding: 0.25rem 1rem;
    min-height: auto;
}

/* Hide Hero/Title elements - keep only breadcrumb */
.t-Body-title h1,
.t-Body-title .t-Body-title-shrinkWrap,
.t-Hero,
.t-HeroRegion {
    display: none !important;
}

/* Breadcrumb Container - compact */
.t-Breadcrumb {
    padding: 0;
    margin: 0;
}

.t-Breadcrumb-region {
    padding: 0;
}

/* Breadcrumb Links - smaller text */
.t-Breadcrumb-item {
    color: var(--soft-steel);
    font-size: 0.75rem;
    line-height: 1.4;
}

.t-Breadcrumb-item a {
    color: var(--teal-intense) !important;
    text-decoration: none;
    font-size: 0.75rem;
}

.t-Breadcrumb-item a:hover {
    color: var(--emerald-abyss) !important;
    text-decoration: underline;
}

/* Breadcrumb Separator */
.t-Breadcrumb-item::before {
    color: var(--soft-steel);
    font-size: 0.625rem;
    margin: 0 0.375rem;
}

/* Current Page in Breadcrumb */
.t-Breadcrumb-item:last-child {
    color: var(--graphite-depth);
    font-weight: 500;
    font-size: 0.75rem;
}

/* Buttons inside Breadcrumb Area - smaller */
.t-Body-title .t-Button {
    background: rgba(26, 139, 125, 0.1) !important;
    border-color: var(--teal-intense) !important;
    color: var(--teal-intense) !important;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.t-Body-title .t-Button:hover {
    background: var(--teal-intense) !important;
    color: #ffffff !important;
}

.t-Header-branding {
    background: transparent;
}

.t-Header-logo-link {
    color: var(--emerald-abyss);
    font-family: var(--ut-heading-font-family);
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Logo Image */
.t-Header-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.t-Header-logo-link img {
    max-height: 40px;
    width: auto;
}

.t-Header .t-Header-nav-list-item a {
    color: var(--graphite-depth);
}

.t-Header .t-Header-nav-list-item a:hover {
    color: var(--teal-intense);
}

/* Header Controls (icons, buttons) */
.t-Header .t-Button--header,
.t-Header .t-Header-navBar a {
    color: var(--soft-steel) !important;
}

.t-Header .t-Button--header:hover,
.t-Header .t-Header-navBar a:hover {
    color: var(--teal-intense) !important;
    background: rgba(26, 139, 125, 0.08);
}

/* ----- Navigation (Tree/Side) ----- */
.t-TreeNav {
    background: var(--emerald-abyss);
}

.t-TreeNav .a-TreeView-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.t-TreeNav .a-TreeView-node:hover .a-TreeView-label,
.t-TreeNav .a-TreeView-node.is-focused .a-TreeView-label {
    color: var(--mint-signal);
}

.t-TreeNav .a-TreeView-node.is-selected > .a-TreeView-content {
    background: rgba(183, 228, 213, 0.15);
}

.t-TreeNav .a-TreeView-node.is-selected .a-TreeView-label {
    color: var(--mint-signal);
    font-weight: 600;
}

/* ----- Buttons ----- */
.t-Button {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Hot/Primary Action - Teal translucido */
.t-Button--hot {
    background-color: rgba(26, 139, 125, 0.85) !important;
    border: 1px solid rgba(26, 139, 125, 0.4) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--hot:hover {
    background-color: rgba(11, 45, 42, 0.92) !important;
    border-color: rgba(11, 45, 42, 0.5) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Primary/Secondary - Emerald translucido */
.t-Button--primary {
    background-color: rgba(11, 45, 42, 0.85) !important;
    border: 1px solid rgba(11, 45, 42, 0.4) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--primary:hover {
    background-color: rgba(11, 45, 42, 0.95) !important;
    color: #ffffff !important;
}

/* Success - Verde translucido */
.t-Button--success {
    background-color: rgba(16, 185, 129, 0.85) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--success:hover {
    background-color: rgba(13, 150, 104, 0.92) !important;
    border-color: rgba(13, 150, 104, 0.5) !important;
    color: #ffffff !important;
}

/* Danger - Vermelho translucido */
.t-Button--danger {
    background-color: rgba(220, 38, 38, 0.85) !important;
    border: 1px solid rgba(220, 38, 38, 0.4) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--danger:hover {
    background-color: rgba(185, 28, 28, 0.92) !important;
    border-color: rgba(185, 28, 28, 0.5) !important;
    color: #ffffff !important;
}

/* Warning - Laranja translucido */
.t-Button--warning {
    background-color: rgba(230, 81, 0, 0.85) !important;
    border: 1px solid rgba(230, 81, 0, 0.4) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--warning:hover {
    background-color: rgba(199, 80, 0, 0.92) !important;
    border-color: rgba(199, 80, 0, 0.5) !important;
    color: #ffffff !important;
}

/* Default/Outline - Vidro fosco */
.t-Button--simple,
.t-Button:not([class*="--"]) {
    background-color: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(229, 232, 235, 0.7) !important;
    color: var(--graphite-depth) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.t-Button--simple:hover,
.t-Button:not([class*="--"]):hover {
    background-color: rgba(255, 255, 255, 0.85) !important;
    border-color: var(--mint-signal) !important;
    color: var(--graphite-depth) !important;
}

/* ----- Regions ----- */
.t-Region {
    border-radius: 12px;
    border: 1px solid var(--soft-arctic);
    box-shadow: var(--shadow-sm);
    background: #ffffff;
}

.t-Region-header {
    border-bottom: 1px solid var(--soft-arctic);
    padding: 1rem 1.25rem;
}

.t-Region-title {
    font-family: var(--ut-heading-font-family);
    color: var(--emerald-abyss);
    font-weight: 600;
    font-size: 1.125rem;
}

.t-Region-body {
    padding: 1.25rem;
}

/* ----- Cards ----- */
.t-Cards-item {
    border-radius: 12px;
    border: 1px solid var(--soft-arctic);
    background: #ffffff;
    transition: all 0.3s ease;
}

.t-Cards-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--mint-signal);
}

.t-Card-title {
    font-family: var(--ut-heading-font-family);
    color: var(--emerald-abyss);
    font-weight: 600;
}

.t-Card-body {
    color: var(--soft-steel);
}

/* ----- Forms ----- */
.t-Form-label {
    font-size: 0.875rem;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--graphite-depth);
    margin-bottom: 0.375rem;
}

.t-Form-inputContainer input,
.t-Form-inputContainer select,
.t-Form-inputContainer textarea,
.apex-item-text,
.apex-item-select,
.apex-item-textarea {
    border: 1px solid var(--soft-arctic);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(11, 45, 42, 0.06);
}

.t-Form-inputContainer input:focus,
.t-Form-inputContainer select:focus,
.t-Form-inputContainer textarea:focus,
.apex-item-text:focus,
.apex-item-select:focus,
.apex-item-textarea:focus {
    border-color: var(--teal-intense);
    box-shadow: 0 0 0 3px rgba(26, 139, 125, 0.12);
    outline: none;
}

.t-Form-inputContainer input:hover,
.t-Form-inputContainer select:hover,
.t-Form-inputContainer textarea:hover,
.apex-item-text:hover,
.apex-item-select:hover,
.apex-item-textarea:hover {
    border-color: var(--mint-signal);
    box-shadow: 0 1px 3px rgba(11, 45, 42, 0.1);
}

/* Required field indicator */
.t-Form-fieldContainer--floatingLabel .t-Form-label .t-Form-required {
    color: var(--error);
}

/* ========================================
   ENHANCED SELECT COMPONENTS
   ======================================== */

/* ----- Custom Select Wrapper ----- */
.phd-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.phd-select-wrapper::after {
    content: '\f078';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft-steel);
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.phd-select-wrapper:focus-within::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--teal-intense);
}

/* ----- Enhanced Native Select ----- */
.apex-item-select,
select.phd-select,
.t-Form-inputContainer select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 12px;
    padding-right: 2.5rem !important;
    cursor: pointer;
    background-color: #ffffff;
}

.apex-item-select:hover,
select.phd-select:hover {
    border-color: var(--mint-signal);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a8b7d' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
}

.apex-item-select:focus,
select.phd-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a8b7d' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
}

/* Select with icon prefix */
.phd-select-icon {
    position: relative;
}

.phd-select-icon .phd-select-icon__icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft-steel);
    pointer-events: none;
    z-index: 1;
}

.phd-select-icon select {
    padding-left: 2.5rem !important;
}

/* ----- Enhanced Popup LOV ----- */
.apex-item-popup-lov,
.a-PopupLOV-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1.5px solid rgba(183, 228, 213, 0.4);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.apex-item-popup-lov:hover,
.a-PopupLOV-value:hover {
    border-color: var(--mint-signal);
    background: rgba(183, 228, 213, 0.03);
}

.apex-item-popup-lov:focus,
.a-PopupLOV-value:focus {
    border-color: var(--teal-intense);
    box-shadow: 0 0 0 3px rgba(26, 139, 125, 0.12);
    outline: none;
}

/* LOV Search Icon */
.a-PopupLOV-doSearch,
.apex-item-popup-lov-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -0.375rem -0.5rem -0.375rem 0.5rem;
    background: var(--arctic-mist);
    border-radius: 6px;
    color: var(--soft-steel);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a-PopupLOV-doSearch:hover,
.apex-item-popup-lov-btn:hover {
    background: var(--mint-signal);
    color: var(--emerald-abyss);
}

/* LOV Clear Button */
.a-PopupLOV-clear {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--soft-steel);
    border: none;
    cursor: pointer;
    margin-right: 0.25rem;
    opacity: 0.6;
    transition: all 0.15s ease;
}

.a-PopupLOV-clear:hover {
    background: var(--error-light);
    color: var(--error);
    opacity: 1;
}

/* ----- Popup LOV Dialog ----- */
.ui-dialog.a-PopupLOV-dialog,
.a-PopupLOV {
    border-radius: 12px !important;
    border: 1px solid var(--soft-arctic) !important;
    box-shadow: 0 20px 40px -8px rgba(11, 45, 42, 0.25) !important;
    overflow: hidden;
}

.a-PopupLOV-dialog .ui-dialog-titlebar,
.a-PopupLOV-header {
    background: var(--cloud) !important;
    border-bottom: 1px solid var(--soft-arctic) !important;
    padding: 1rem 1.25rem !important;
}

.a-PopupLOV-dialog .ui-dialog-title,
.a-PopupLOV-title {
    font-family: var(--ut-heading-font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--emerald-abyss);
}

/* LOV Search Input */
.a-PopupLOV-search,
.a-PopupLOV-searchField {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--arctic-mist);
    border-bottom: 1px solid var(--soft-arctic);
}

.a-PopupLOV-search input,
.a-PopupLOV-searchField input {
    flex: 1;
    border: 1.5px solid var(--soft-arctic);
    border-radius: 8px;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    font-size: 0.875rem;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 0.875rem center;
    transition: all 0.2s ease;
}

.a-PopupLOV-search input:focus,
.a-PopupLOV-searchField input:focus {
    border-color: var(--teal-intense);
    box-shadow: 0 0 0 3px rgba(26, 139, 125, 0.12);
    outline: none;
}

/* LOV Results List */
.a-PopupLOV-results,
.a-PopupLOV-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.a-PopupLOV-results li,
.a-PopupLOV-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--graphite-depth);
}

.a-PopupLOV-results li:hover,
.a-PopupLOV-item:hover {
    background: rgba(183, 228, 213, 0.1);
}

.a-PopupLOV-results li.is-focused,
.a-PopupLOV-results li.is-selected,
.a-PopupLOV-item--selected {
    background: rgba(26, 139, 125, 0.1);
    color: var(--teal-intense);
}

.a-PopupLOV-results li.is-selected::before,
.a-PopupLOV-item--selected::before {
    content: '\f00c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.75rem;
    color: var(--teal-intense);
}

/* LOV Pagination */
.a-PopupLOV-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--arctic-mist);
    border-top: 1px solid var(--soft-arctic);
}

.a-PopupLOV-pagination button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--soft-arctic);
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8125rem;
}

.a-PopupLOV-pagination button:hover {
    border-color: var(--teal-intense);
    color: var(--teal-intense);
}

.a-PopupLOV-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----- Select Many / Shuttle ----- */
.apex-item-select[multiple],
select.phd-select-many {
    height: auto;
    min-height: 120px;
    padding: 0.5rem;
    background-image: none;
}

.apex-item-select[multiple] option,
select.phd-select-many option {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.apex-item-select[multiple] option:hover {
    background: rgba(183, 228, 213, 0.15);
}

.apex-item-select[multiple] option:checked {
    background: linear-gradient(0deg, rgba(26, 139, 125, 0.15) 0%, rgba(26, 139, 125, 0.15) 100%);
    color: var(--teal-intense);
}

/* Shuttle Component */
.a-Shuttle {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.a-Shuttle-list {
    flex: 1;
    border: 1.5px solid var(--soft-arctic);
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
}

.a-Shuttle-listHeader {
    padding: 0.625rem 0.875rem;
    background: var(--arctic-mist);
    border-bottom: 1px solid var(--soft-arctic);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--soft-steel);
}

.a-Shuttle-listBody {
    padding: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.a-Shuttle-listBody option {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    cursor: pointer;
}

.a-Shuttle-listBody option:hover {
    background: rgba(183, 228, 213, 0.1);
}

.a-Shuttle-listBody option:checked {
    background: rgba(26, 139, 125, 0.12);
    color: var(--teal-intense);
}

/* Shuttle Buttons */
.a-Shuttle-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.a-Shuttle-buttons button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--soft-arctic);
    background: #ffffff;
    color: var(--soft-steel);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a-Shuttle-buttons button:hover {
    border-color: var(--teal-intense);
    color: var(--teal-intense);
    background: rgba(26, 139, 125, 0.05);
}

.a-Shuttle-buttons button:active {
    background: var(--teal-intense);
    color: #ffffff;
    transform: scale(0.95);
}

/* ----- Custom PHD Select Component ----- */
.phd-select {
    position: relative;
}

.phd-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid rgba(183, 228, 213, 0.4);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.phd-select__trigger:hover {
    border-color: var(--mint-signal);
}

.phd-select__trigger--open {
    border-color: var(--teal-intense);
    box-shadow: 0 0 0 3px rgba(26, 139, 125, 0.12);
    border-radius: 8px 8px 0 0;
}

.phd-select__value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    color: var(--graphite-depth);
}

.phd-select__placeholder {
    color: var(--soft-steel);
    opacity: 0.7;
}

.phd-select__arrow {
    color: var(--soft-steel);
    transition: transform 0.2s ease;
}

.phd-select__trigger--open .phd-select__arrow {
    transform: rotate(180deg);
    color: var(--teal-intense);
}

.phd-select__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1.5px solid var(--teal-intense);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 24px -4px rgba(11, 45, 42, 0.18);
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.phd-select__dropdown--open {
    display: block;
}

.phd-select__search {
    position: sticky;
    top: 0;
    padding: 0.75rem;
    background: var(--arctic-mist);
    border-bottom: 1px solid var(--soft-arctic);
}

.phd-select__search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--soft-arctic);
    border-radius: 6px;
    font-size: 0.8125rem;
}

.phd-select__search input:focus {
    border-color: var(--teal-intense);
    outline: none;
}

.phd-select__options {
    padding: 0.5rem;
}

.phd-select__option {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
}

.phd-select__option:hover {
    background: rgba(183, 228, 213, 0.1);
}

.phd-select__option--selected {
    background: rgba(26, 139, 125, 0.1);
    color: var(--teal-intense);
}

.phd-select__option--selected::before {
    content: '\f00c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.625rem;
    font-size: 0.75rem;
}

.phd-select__option--highlighted {
    background: var(--arctic-mist);
}

.phd-select__group-label {
    padding: 0.5rem 0.875rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--soft-steel);
    border-bottom: 1px solid var(--soft-arctic);
    margin-bottom: 0.25rem;
}

/* Multi-select Tags */
.phd-select__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.phd-select__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(26, 139, 125, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--teal-intense);
}

.phd-select__tag-remove {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.625rem;
}

.phd-select__tag-remove:hover {
    background: var(--error-light);
    color: var(--error);
}

/* Empty state */
.phd-select__empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--soft-steel);
    font-size: 0.875rem;
}

.phd-select__empty-icon {
    font-size: 2rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

/* ----- Interactive Report / Grid ----- */
.a-IRR-header,
.a-IG-header {
    background: var(--arctic-mist);
    border-bottom: 1px solid var(--soft-arctic);
    padding: 0.75rem 1rem;
}

.a-IRR-table th,
.a-IG-header .a-IG-headerCell {
    background: var(--arctic-mist);
    color: var(--soft-steel);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.a-IRR-table tr:hover,
.a-IG-row:hover {
    background: rgba(183, 228, 213, 0.08);
}

.a-IRR-table tr.is-selected,
.a-IG-row.is-selected {
    background: rgba(183, 228, 213, 0.25) !important;
}

.a-IRR-table tr.is-selected td,
.a-IG-row.is-selected .a-GV-cell {
    color: var(--graphite-depth) !important;
}

/* Focused row (keyboard navigation) */
.a-IG-row.is-focused {
    background: rgba(183, 228, 213, 0.15) !important;
    outline: 2px solid var(--teal-intense);
    outline-offset: -2px;
}

/* IG Search Bar */
.a-IG-search input,
.a-IRR-search input {
    border: 1px solid var(--soft-arctic);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(11, 45, 42, 0.06);
}

/* IRR Search Button - Replace "Go" with "Buscar" */
.a-IRR-search-field button[type="button"],
.a-IRR-button--search,
button.a-IRR-button[title*="Search"],
.a-IRR-search button {
    font-size: 0;
    min-width: 70px;
}

.a-IRR-search-field button[type="button"]::after,
.a-IRR-button--search::after,
button.a-IRR-button[title*="Search"]::after,
.a-IRR-search button::after {
    content: "Buscar";
    font-size: 0.875rem;
}

.a-IG-search input:focus,
.a-IRR-search input:focus {
    border-color: var(--teal-intense);
    box-shadow: 0 0 0 3px rgba(26, 139, 125, 0.12);
    outline: none;
}

/* IG Toolbar Buttons */
.a-IG-button,
.a-IRR-button,
.a-Toolbar-item {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--soft-arctic);
    background: #ffffff;
    color: var(--soft-steel);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.a-IG-button:hover,
.a-IRR-button:hover,
.a-Toolbar-item:hover {
    background: var(--arctic-mist);
    border-color: var(--mint-signal);
    color: var(--graphite-depth);
}

.a-IG-button:active,
.a-IRR-button:active {
    background: var(--mint-signal);
    transform: scale(0.98);
}

.a-IG-button.is-active,
.a-IRR-button.is-active {
    background: var(--teal-intense);
    border-color: var(--teal-intense);
    color: #ffffff;
}

/* IG View Toggle */
.a-IG-controlsBar .a-Button,
.a-IG-controls .a-Button {
    border-radius: 8px;
    border: 1px solid var(--soft-arctic);
}

/* IG Filter Tags */
.a-IG-filterTag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: #ffffff;
    border: 1px solid var(--soft-arctic);
    border-radius: 6px;
    font-size: 0.75rem;
}

.a-IG-filterTag:hover {
    border-color: var(--teal-intense);
}

/* IG Pagination */
.a-IG-footer {
    background: var(--arctic-mist);
    border-top: 1px solid var(--soft-arctic);
    padding: 0.75rem 1rem;
}

.a-IG-pageBtn,
.a-Pagination-item {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--soft-arctic);
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.a-IG-pageBtn:hover,
.a-Pagination-item:hover {
    border-color: var(--teal-intense);
    color: var(--teal-intense);
}

.a-IG-pageBtn.is-active,
.a-Pagination-item.is-active {
    background: var(--teal-intense);
    border-color: var(--teal-intense);
    color: #ffffff;
    font-weight: 500;
}

/* IG Row Actions */
.a-IG-rowBtn {
    padding: 0.375rem;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.a-IG-rowBtn:hover {
    background: var(--arctic-mist);
}

.a-IG-rowBtn--edit {
    color: var(--teal-intense);
}

.a-IG-rowBtn--view {
    color: var(--soft-steel);
}

.a-IG-rowBtn--delete {
    color: var(--error);
}

/* ----- Breadcrumbs ----- */
.t-Breadcrumb {
    font-size: 0.875rem;
}

.t-Breadcrumb-item {
    color: var(--soft-steel);
}

.t-Breadcrumb-item a {
    color: var(--teal-intense);
    text-decoration: none;
}

.t-Breadcrumb-item a:hover {
    color: var(--emerald-abyss);
    text-decoration: underline;
}

/* ----- Alerts ----- */
.t-Alert--success {
    background: var(--success-light);
    border-color: var(--success);
    color: #065f46;
}

.t-Alert--warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: #9a3412;
}

.t-Alert--danger {
    background: var(--error-light);
    border-color: var(--error);
    color: #991b1b;
}

.t-Alert--info {
    background: var(--info-light);
    border-color: var(--info);
    color: #1e40af;
}

/* ----- Tabs ----- */
.t-Tabs-item {
    border-radius: 8px 8px 0 0;
}

.t-Tabs-item.is-active {
    background: #ffffff;
    border-bottom-color: #ffffff;
}

.t-Tabs-link {
    color: var(--soft-steel);
    font-weight: 500;
}

.t-Tabs-item.is-active .t-Tabs-link {
    color: var(--teal-intense);
}

/* ----- Modal / Dialog ----- */
.ui-dialog {
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.ui-dialog .ui-dialog-titlebar {
    background: var(--emerald-abyss);
    color: #ffffff;
    border-radius: 16px 16px 0 0;
    font-family: var(--ut-heading-font-family);
}

.ui-dialog .ui-dialog-content {
    padding: 1.5rem;
}

/* ----- Badges / Tags ----- */
.t-Badge {
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.75rem;
}

/* ----- Search Bar ----- */
.t-Header-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(183, 228, 213, 0.3);
    color: #ffffff;
    border-radius: 8px;
}

.t-Header-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.t-Header-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--mint-signal);
}

/* ----- Pagination ----- */
.t-Pagination {
    gap: 0.25rem;
}

.t-Pagination-item {
    border-radius: 8px;
}

.t-Pagination-item.is-active {
    background: var(--teal-intense);
    color: #ffffff;
}


/* ================================================
   4. UTILITY CLASSES
   ================================================ */

/* Background Colors */
.phd-bg-emerald { background-color: var(--emerald-abyss) !important; }
.phd-bg-cloud { background-color: var(--cloud) !important; }
.phd-bg-arctic { background-color: var(--arctic-mist) !important; }
.phd-bg-mint { background-color: var(--mint-signal) !important; }

/* Text Colors */
.phd-text-emerald { color: var(--emerald-abyss) !important; }
.phd-text-graphite { color: var(--graphite-depth) !important; }
.phd-text-steel { color: var(--soft-steel) !important; }
.phd-text-teal { color: var(--teal-intense) !important; }

/* Border Colors */
.phd-border-arctic { border-color: var(--soft-arctic) !important; }
.phd-border-mint { border-color: var(--mint-signal) !important; }
.phd-border-teal { border-color: var(--teal-intense) !important; }

/* Shadows */
.phd-shadow-sm { box-shadow: var(--shadow-sm) !important; }
.phd-shadow-md { box-shadow: var(--shadow-md) !important; }
.phd-shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Border Radius */
.phd-rounded { border-radius: 8px !important; }
.phd-rounded-lg { border-radius: 12px !important; }
.phd-rounded-xl { border-radius: 16px !important; }
.phd-rounded-full { border-radius: 9999px !important; }

/* Font Families */
.phd-font-display { font-family: var(--ut-heading-font-family) !important; }
.phd-font-body { font-family: var(--a-base-font-family) !important; }
.phd-font-mono { font-family: var(--a-code-font-family) !important; }


/* ================================================
   5. NAVIGATION COMPONENTS
   ================================================ */

/* ----- Top Navigation (Area Pills) ----- */
.phd-topnav {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--cloud);
    border-bottom: 1px solid var(--soft-arctic);
}

.phd-topnav__item {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--soft-steel);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.phd-topnav__item:hover {
    background: var(--arctic-mist);
    color: var(--graphite-depth);
}

.phd-topnav__item--active {
    background: var(--emerald-abyss);
    color: #ffffff;
    border-color: var(--emerald-abyss);
}

.phd-topnav__item--active:hover {
    background: var(--emerald-abyss);
    color: #ffffff;
}

/* ----- Sub Navigation (Status Tabs) ----- */
.phd-subnav {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--arctic-mist);
    border-bottom: 1px solid var(--soft-arctic);
}

.phd-subnav__item {
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--soft-steel);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.phd-subnav__item:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--graphite-depth);
}

.phd-subnav__item--active {
    background: #ffffff;
    color: var(--teal-intense);
    box-shadow: var(--shadow-xs);
}

.phd-subnav__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--soft-arctic);
    color: var(--soft-steel);
}

.phd-subnav__item--active .phd-subnav__count {
    background: var(--teal-intense);
    color: #ffffff;
}

/* ----- Tabs (Content Switcher) ----- */
.phd-tabs {
    display: flex;
    border-bottom: 2px solid var(--soft-arctic);
}

.phd-tabs__item {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--soft-steel);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.phd-tabs__item:hover {
    color: var(--graphite-depth);
    background: rgba(183, 228, 213, 0.08);
}

.phd-tabs__item--active {
    color: var(--teal-intense);
    border-bottom-color: var(--teal-intense);
}

/* ----- Pills (Inline Filter) ----- */
.phd-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.phd-pills__item {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--soft-steel);
    background: var(--arctic-mist);
    border: 1px solid var(--soft-arctic);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.phd-pills__item:hover {
    border-color: var(--teal-intense);
    color: var(--teal-intense);
}

.phd-pills__item--active {
    background: var(--teal-intense);
    border-color: var(--teal-intense);
    color: #ffffff;
}

/* ----- Chips (Entity Tags) ----- */
.phd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.phd-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--graphite-depth);
    background: #ffffff;
    border: 1px solid var(--soft-arctic);
    cursor: pointer;
    transition: all 0.2s ease;
}

.phd-chip:hover {
    border-color: var(--mint-signal);
    background: rgba(183, 228, 213, 0.08);
}

.phd-chip--active {
    border-color: var(--teal-intense);
    background: rgba(26, 139, 125, 0.08);
    color: var(--teal-intense);
}

.phd-chip__icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.phd-chip__remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.phd-chip__remove:hover {
    opacity: 1;
    background: var(--error-light);
    color: var(--error);
}

/* ----- Sidebar Navigation ----- */
.phd-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.phd-sidebar-nav__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--soft-steel);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.phd-sidebar-nav__item:hover {
    background: rgba(183, 228, 213, 0.08);
    color: var(--graphite-depth);
}

.phd-sidebar-nav__item--active {
    background: rgba(26, 139, 125, 0.1);
    color: var(--teal-intense);
}

.phd-sidebar-nav__icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.phd-sidebar-nav__item--active .phd-sidebar-nav__icon {
    opacity: 1;
}

.phd-sidebar-nav__badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--soft-arctic);
    color: var(--soft-steel);
}

.phd-sidebar-nav__item--active .phd-sidebar-nav__badge {
    background: var(--teal-intense);
    color: #ffffff;
}

/* ----- Icon Rail (Vertical) ----- */
.phd-icon-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--emerald-abyss);
    width: 60px;
}

.phd-icon-rail__item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.phd-icon-rail__item:hover {
    background: rgba(183, 228, 213, 0.15);
    color: var(--mint-signal);
}

.phd-icon-rail__item--active {
    background: rgba(183, 228, 213, 0.2);
    color: var(--mint-signal);
}

/* ----- APEX Tab Override ----- */
.t-TabsRegion .t-Tabs-item {
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
}

.t-TabsRegion .t-Tabs-link {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
}

.t-TabsRegion .t-Tabs-item.is-active .t-Tabs-link {
    color: var(--teal-intense);
    border-bottom: 2px solid var(--teal-intense);
}

/* ----- APEX Menu Navigation Override ----- */
.t-NavigationBar .t-NavigationBar-menu .t-NavigationBar-item {
    border-radius: 8px;
}

.t-NavigationBar .t-NavigationBar-menu .t-NavigationBar-item.is-active {
    background: rgba(183, 228, 213, 0.15);
}


/* ================================================
   6. RESPONSIVE ADJUSTMENTS
   ================================================ */

@media (max-width: 640px) {
    .t-Region {
        border-radius: 8px;
    }

    .t-Cards-item {
        border-radius: 8px;
    }

    .t-Region-body {
        padding: 1rem;
    }

    .phd-topnav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .phd-subnav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}
