/* Base Styles */
* { font-family: "Georgia", serif !important; }
h1, h2, h3, h4, h5, h6 { font-family: "Verdana", sans-serif !important; }
a:hover { text-decoration: underline !important; }

/* Layout Variables */
:root {
    --margin-default: 40px !important;
    --margin-text-right: 540px !important;
    --margin-text-left: 200px !important;
    --margin-table-container-right: 380px !important;
    --purple: #642888;
    --red: #dc3545;
    --blue: #007bff;
}

/* Header & Navigation */
.left-header, .right-header { gap: 1rem !important; }
.right-header, .footer, .article, .article-top-right { margin-right: var(--margin-default) !important; }
.left-header, .footer, .articles, .article-top-left { margin-left: var(--margin-default) !important; }
.nav-link.active, .nav-link:not(.active):hover { color: var(--purple) !important; }

/* Side Menu */
.menu-lateral-1 {
    margin-top: 50px;
    margin-left: 20px;
}
.menu-lateral-1-col {
    margin-top: 350px;
    color: var(--purple);
}
.first-menu-lateral-1, .menu-lateral-2-col { color: var(--purple); }

/* Text & Content */
.text {
    margin-left: var(--margin-text-left) !important;
    margin-right: var(--margin-text-right) !important;
}
.table-container {
    margin-left: var(--margin-default) !important;
    margin-right: var(--margin-table-container-right) !important;
}

/* Images */
.article-image, .index-image {
    width: 130px;
    height: 73px;
    object-fit: contain;
}

/* Offcanvas */
#fullPageOffcanvas {
    top: 49px;
    height: calc(100vh - 49px);
    width: 100vw;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.offcanvas-backdrop { display: none !important; }
header { z-index: 1045; }

/* Numbered Lists */
.big-red-numbers {
    list-style: none;
    padding-left: 0;
}
.big-red-numbers li {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 0.75rem;
}
.big-red-numbers li::before {
    content: counters(list-item, ".") ".";
    position: absolute;
    left: 0;
    width: 2rem;
    color: var(--red);
    font-weight: bold;
    font-size: 1.25em;
    text-align: right;
}

/* Tables */
table { border-collapse: collapse; width: 100%; margin-top: 10px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; font-weight: bold; cursor: pointer; position: relative; padding-right: 25px; }
th:hover { background-color: #e9e9e9; }
.sortable::after { content:"\25B4 \25BC"; position: absolute; right: 8px; font-size: 12px; color: #666; letter-spacing: -1px; }
.sort-asc::after { content: "\25B4"; color: #000; }
.sort-desc::after { content: "\25BC"; color: #000; }

/* Bars & Percentages */
.bar-container { width: 100%; height: 5px; border-radius: 3px; margin-top: 3px; }
.bar { height: 100%; border-radius: 3px; }
.trump-bar { background-color: var(--red); }
.mfn-bar { background-color: var(--blue); }
.percentage-value { display: inline-block; width: 40px; text-align: right; margin-right: 5px; }

/* UI Components */
.icon-transition { transition: transform 0.3s ease; }
.rotated { transform: rotate(90deg); }
.toggle-btn { padding: 8px 16px; background-color: var(--purple); color: white; border: none; border-radius: 4px; cursor: pointer; }

/* Popovers */
.popover-container { position: relative; display: inline-block; }
.popover {
    display: none; position: absolute; left: 100%; top: 0; margin-left: 8px;
    background-color: white; border: 1px solid #ddd; border-radius: 4px;
    padding: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 100; min-width: 60px;
}
.popover.show { display: block; }
.value-controls { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arrow-btn {
    background: none; border: none; cursor: pointer; font-size: 16px;
    padding: 4px 12px; color: #555;
}
.arrow-btn:hover { color: #000; }
.popover-value-display {
    font-size: 16px; padding: 4px 0; font-weight: bold;
    position: static; opacity: 1; background: none; color: inherit; transform: none;
}

/* Color Picker */
.color-picker-container { position: relative; display: inline-block; }
.color-picker-popover {
    display: none; position: absolute; left: 0; top: 100%; margin-top: 8px;
    background-color: white; border: 1px solid #ddd; border-radius: 4px;
    padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 100; width: 220px;
}
.color-picker-popover.show { display: block; }
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.color-swatch {
    width: 25px; height: 25px; border-radius: 4px; cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1); transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.1); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.color-swatch.selected { box-shadow: 0 0 0 2px #000; }

/* Responsive */
@media (max-width: 1090px) {
    :root {
        --margin-text-right: 40px !important;
        --margin-text-left: 40px !important;
        --margin-default: 40px !important;
        --margin-table-container-right: 40px !important;
    }
}
@media (min-width: 1500px) {
    :root {
        --margin-default-right: 250px !important;
        --margin-default-left: 250px !important;
    }
}
@media (max-width: 992px) {
    .menu-lateral-1 { display: none; }
    .custom-text { margin-right: 10px !important; margin-left: 10px !important; }
}
@media (min-width: 992px) {
    .custom-text { margin-right: 100px !important; }
}

/* Purple Theme Elements */
.overflow-x-auto, .footer, .form-control::placeholder { color: var(--purple) !important; }