:root {
    --theme-border: none;
    --theme-transition: all 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955);
    --theme-list-indent: 2.5em;
    --true: initial;
    --false: "";
    --has-link-decoration: var(--true);
    --has-transparent-header: 0;
    --theme-container-width: min(100%, var(--theme-container-width-base));
    --theme-container-width-base: calc(var(--theme-container-edge-spacing, 90vw) - var(--theme-frame-size, 0px) * 2);
    --theme-font-stack-default: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --rankmath-wp-adminbar-height: 0;
    --swiper-navigation-size: 44px;
    --swiper-theme-color: #007aff;
    --wp--style--block-gap: var(--theme-content-spacing, 1.5em);
    --wp--style--global--content-size: var(--theme-block-max-width, 1200px);
    --wp--style--global--wide-size: var(--theme-block-wide-max-width, 1400px);

    --wp--preset--aspect-ratio--square: 1;
    --wp--preset--aspect-ratio--4-3: 4 / 3;
    --wp--preset--aspect-ratio--3-4: 3 / 4;
    --wp--preset--aspect-ratio--3-2: 3 / 2;
    --wp--preset--aspect-ratio--2-3: 2 / 3;
    --wp--preset--aspect-ratio--16-9: 16 / 9;
    --wp--preset--aspect-ratio--9-16: 9 / 16;
    --wp--preset--color--black: #000000;
    --wp--preset--color--cyan-bluish-gray: #abb8c3;
    --wp--preset--color--white: #ffffff;
    --wp--preset--color--pale-pink: #f78da7;
    --wp--preset--color--vivid-red: #cf2e2e;
    --wp--preset--color--luminous-vivid-orange: #ff6900;
    --wp--preset--color--luminous-vivid-amber: #fcb900;
    --wp--preset--color--light-green-cyan: #7bdcb5;
    --wp--preset--color--vivid-green-cyan: #00d084;
    --wp--preset--color--pale-cyan-blue: #8ed1fc;
    --wp--preset--color--vivid-cyan-blue: #0693e3;
    --wp--preset--color--vivid-purple: #9b51e0;
    --wp--preset--color--palette-color-1: var(--theme-palette-color-1, #076951);
    --wp--preset--color--palette-color-2: var(--theme-palette-color-2, #16876b);
    --wp--preset--color--palette-color-3: var(--theme-palette-color-3, #365951);
    --wp--preset--color--palette-color-4: var(--theme-palette-color-4, #192c27);
    --wp--preset--color--palette-color-5: var(--theme-palette-color-5, #E7F4F1);
    --wp--preset--color--palette-color-6: var(--theme-palette-color-6, #F2F7F6);
    --wp--preset--color--palette-color-7: var(--theme-palette-color-7, #f8fafa);
    --wp--preset--color--palette-color-8: var(--theme-palette-color-8, #ffffff);

    --theme-font-family: 'IBM Plex Sans Arabic', Sans-Serif;
    --theme-font-weight: 400;
    --theme-text-transform: none;
    --theme-text-decoration: none;
    --theme-font-size: 22px;
    --theme-line-height: 1.65;
    --theme-letter-spacing: 0em;
    --theme-button-font-weight: 500;
    --theme-button-font-size: 15px;
    --has-classic-forms: var(--true);
    --has-modern-forms: var(--false);
    --theme-form-field-height: 45px;
    --theme-form-field-border-radius: 10px;
    --theme-form-field-border-initial-color: var(--theme-border-color);
    --theme-form-field-border-focus-color: var(--theme-palette-color-1);
    --theme-form-field-border-width: 2px;
    --theme-form-selection-field-initial-color: var(--theme-border-color);
    --theme-form-selection-field-active-color: var(--theme-palette-color-1);
    --theme-palette-color-1: #076951;
    --theme-palette-color-2: #16876b;
    --theme-palette-color-3: #365951;
    --theme-palette-color-4: #192c27;
    --theme-palette-color-5: #E7F4F1;
    --theme-palette-color-6: #F2F7F6;
    --theme-palette-color-7: #f8fafa;
    --theme-palette-color-8: #ffffff;
    --theme-text-color: var(--theme-palette-color-3);
    --theme-link-initial-color: var(--theme-palette-color-1);
    --theme-link-hover-color: var(--theme-palette-color-2);
    --theme-selection-text-color: #ffffff;
    --theme-selection-background-color: var(--theme-palette-color-1);
    --theme-border-color: var(--theme-palette-color-5);
    --theme-headings-color: var(--theme-palette-color-4);
    --theme-content-spacing: 1.5em;
    --theme-button-min-height: 40px;
    --theme-button-shadow: none;
    --theme-button-transform: none;
    --theme-button-text-initial-color: #ffffff;
    --theme-button-text-hover-color: #ffffff;
    --theme-button-background-initial-color: var(--theme-palette-color-1);
    --theme-button-background-hover-color: var(--theme-palette-color-2);
    --theme-button-border: none;
    --theme-button-border-radius: 8px;
    --theme-button-padding: 5px 20px;
    --theme-normal-container-max-width: 1290px;
    --theme-content-vertical-spacing: 60px;
    --theme-container-edge-spacing: 90vw;
    --theme-narrow-container-max-width: 750px;
    --theme-wide-offset: 130px;

    /* Plugin Design Tokens mapped to Theme Palette */
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 161 88% 22%; /* mapped to #076951 */
    --primary-foreground: 0 0% 100%;
    --secondary: 164 29% 93%; /* mapped to #E7F4F1 */
    --secondary-foreground: 164 25% 13%;
    --muted: 165 25% 96%; /* mapped to #F2F7F6 */
    --muted-foreground: 164 25% 28%;
    --accent: 164 29% 93%;
    --accent-foreground: 161 88% 22%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 164 29% 90%;
    --input: 164 29% 90%;
    --ring: 161 88% 22%;
    --radius: 0.5rem;
}

/* Base resets & typography for Parliament container */
.parliament-container * {
    font-family: inherit;
    box-sizing: border-box;
}

.parliament-container {
    font-family: inherit;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    direction: rtl;
    text-align: right;
    width: 100%;
    margin: 0 auto;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body.parliament-embed-wrapper,
body.parliament-embed-wrapper * {
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Canvas Visualization */
#parliament-canvas {
    cursor: pointer;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

#canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* shadcn-inspired button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
    border: 1px solid transparent;
    user-select: none;
    white-space: nowrap;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:hover {
    background-color: hsl(142.1 76.2% 31%);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover {
    background-color: hsl(240 4.8% 90%);
}

.btn-secondary.active {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-outline {
    background-color: transparent;
    color: hsl(var(--foreground));
    border-color: hsl(var(--input));
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover {
    background-color: hsl(0 84.2% 52%);
}

/* shadcn-inspired card */
.card {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.2s ease-in-out;
}

/* shadcn-inspired input */
.input {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--foreground));
    transition: all 0.15s ease-in-out;
    outline: none;
}

.input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* shadcn-inspired select */
.select {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--foreground));
    transition: all 0.15s ease-in-out;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-left: 2.25rem;
}

.select:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* shadcn-inspired badge */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent;
}

.badge-default {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.badge-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.badge-outline {
    background-color: transparent;
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

/* shadcn-inspired switch */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 1.5rem;
    width: 2.75rem;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 9999px;
    border: 2px solid transparent;
    transition: background-color 0.2s ease-in-out;
    background-color: hsl(var(--input));
}

.switch[data-state="checked"] {
    background-color: hsl(var(--primary));
}

.switch-thumb {
    pointer-events: none;
    display: block;
    height: 1.25rem;
    width: 1.25rem;
    border-radius: 9999px;
    background-color: hsl(var(--background));
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 0.125rem;
}

.switch[data-state="checked"] .switch-thumb {
    left: 1.375rem;
}

/* RTL switch handling */
[dir="rtl"] .switch-thumb {
    left: auto;
    right: 0.125rem;
}

[dir="rtl"] .switch[data-state="checked"] .switch-thumb {
    right: 1.375rem;
}

/* shadcn-inspired dialog/modal */
.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background-color: rgb(0 0 0 / 0.5);
    animation: fadeIn 0.2s ease-out;
    backdrop-filter: blur(4px);
}

.dialog-content {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 50;
    display: grid;
    width: 95%;
    max-width: 56rem;
    transform: translate(-50%, -50%);
    gap: 1rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--background));
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border-radius: calc(var(--radius) + 6px);
    animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Search results dropdown */
.search-results {
    position: absolute;
    z-index: 50;
    margin-top: 0.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--popover));
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    max-height: 20rem;
    overflow-y: auto;
}

#mobile-search-results {
    position: relative;
    z-index: 60;
    max-height: 15rem;
    margin-top: 0.5rem;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    border-bottom: 1px solid hsl(var(--border));
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: hsl(var(--accent));
}

/* Canvas Tooltip */
#tooltip {
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
    background-color: hsl(240 10% 3.9%);
    color: hsl(0 0% 100%);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2);
}

/* Mobile Button Tooltips */
.mobile-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    background-color: hsl(240 10% 3.9%);
    color: hsl(0 0% 100%);
    border-radius: var(--radius);
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    z-index: 10;
    pointer-events: none;
}

.mobile-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: hsl(240 10% 3.9%);
}

.mobile-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.mobile-buttons-container {
    position: relative;
}

#mobile-search-tooltip {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

#mobile-filter-tooltip {
    top: 100%;
    margin-top: 0.5rem;
}

#mobile-search-tooltip::before {
    top: 100%;
    bottom: auto;
    border-top-color: hsl(240 10% 3.9%);
    border-bottom-color: transparent;
}

/* Stats bar */
.stat-bar {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: calc(var(--radius) - 2px);
}

/* Legend item */
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    background-color: hsl(var(--muted));
    font-size: 0.75rem;
    font-weight: 500;
}

.legend-color {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 9999px;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

/* Loading spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 9999px;
    animation: spin 0.8s linear infinite;
}

.separator {
    height: 1px;
    width: 100%;
    background-color: hsl(var(--border));
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--muted));
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.5);
}

.modal-text-content {
    white-space: pre-line;
    word-wrap: break-word;
}
