:root {
    --myred: #800000; /* Original red from El placer de Pensar*/
    --myred-light: #a01020; /* Hover/active variant */
    --mycustomgreen: rgb(220, 240, 230); /* Keep as is */
    --mydarkblue: #00254e; /* Portal blue, keep as is */
    --myblue: #2d89ef; /* Portal blue, keep as is */
    --myyellow: #fdd835; /* Softer yellow */
    --myorange: #f7630c; /* Portal orange, keep as is */
    --mypurple: #8e24aa; /* Slightly softer purple */
    --mygray: #757575; /* Darker gray for better contrast */
    --mylightgray: rgb(219, 214, 214); 
    --mydarkgray: #212121; /* Darker shade for better readability */

    --mybackground: rgb(255, 255, 255); 
    --myborder: #e0e0e0;

    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
}

body{
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0 auto;
    color: var(--mydarkgray);
    line-height: 1.6;
}

.title {
    color: var(--myred);
    font-size: 2.5rem;
    font-weight: 700;
    border-left: 4px solid var(--myyellow);
    padding-left: 14px;
    margin-bottom: 0.5em;
}

.subtitle {
    color: var(--myred);
    font-size: 1.5rem;
    font-weight: 600;
    border-left: 3px solid var(--myyellow);
    padding-left: 12px;
}

.description {
    color: black;
    font-size: 1.2rem;
}

a {
    text-decoration: none;
    color: var(--mydarkgray);
}	

a:hover {
    text-decoration: underline;
}

.page-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px clamp(12px, 3vw, 32px);
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.container {
    flex: 3;
    background-color: var(--mybackground);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.side-container{
    flex: 1;
    padding: 20px;
    background-color: var(--mybackground);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    align-self: flex-start;
}


.author-info ul{
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
}

.author-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    align-items: center;
}

.tag-button {
    background-color: var(--myred);
    color: white;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-align: center;
    transition: background-color 0.2s, transform 0.15s;
}

.tag-button:hover {
    background-color: var(--myred-light);
    text-decoration: none;
    transform: translateY(-1px);
}

.tags-info {
    padding-bottom: 20px;
}

.back-button,
.btn-primary {
    background-color: var(--myred);
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.back-button:hover,
.btn-primary:hover {
    background-color: var(--myred-light);
    box-shadow: 0 2px 8px rgba(128, 0, 0, 0.25);
    text-decoration: none;
}

.removable-tag {
  position: relative;
  padding-right: 1.5em; /* space for the x */
}

.remove-x {
  margin-left: 0.5em;
  font-weight: bold;
  color: #888;
  cursor: pointer;
}

.spaced-hr {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Navigation links */
.link-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.nav-link {
    font-weight: bold;
    text-decoration: none;
    color: var(--myred);
}
.prev-link {
    margin-right: auto;
}

.next-link {
    margin-left: auto;
}

.nav-link:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination .nav-link {
    padding: 8px 18px;
    border: 1px solid var(--myborder);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.pagination .nav-link:hover {
    background-color: var(--myred);
    color: white;
    border-color: var(--myred);
    text-decoration: none;
}

.pagination span {
    padding: 8px 14px;
    font-size: 0.9rem;
    color: var(--mygray);
}

/* Filters */
.filter-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.filter-item {
    border: 1px solid var(--myborder);
    padding: 20px;
    border-radius: 10px;
    margin: 10px 0;
}

.filter-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mydarkgray);
}

/* Inputs & selects globales */
.filter-container input[type="text"],
.filter-container input[type="search"],
.filter-container select {
    padding: 10px 12px;
    border: 1px solid var(--myborder);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    -webkit-appearance: none;
}

.filter-container input[type="text"]:focus,
.filter-container input[type="search"]:focus,
.filter-container select:focus {
    border-color: var(--myred);
    outline: none;
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.1);
}


/* Table */
.table-container {
    place-items: center;
}

table {
    width: auto;
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 1.2rem;
    max-width: 100%; /* Prevent overflow */
}

table th, table td {
    padding: 0.75em;
    border: 1px solid #dee2e6;
    text-align: left;
    white-space: nowrap; /* Prevent wrapping if needed */
}

table thead {
    background-color: #f8f9fa;
}

table tbody tr:nth-child(odd) {
    background-color: #f2f2f2;
}

.tikz-block {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Style for som tex4ht output */
.columns-2 {
    column-count: 2;
    column-gap: 2em;
}
.columns-3 {
    column-count: 3;
    column-gap: 2em;
}

.columns-3 p {
  margin: 0 0 1em 0;
}

.columns-3 dl {
  margin: 0;
  padding: 0;
}

.columns-3 dt,
.columns-3 dd {
  margin: 0;
  padding: 0;
  vertical-align: top;
  display: inline-block;
}

.columns-3 dt {
    width: 2em;  /* or adjust to your label width */
    text-align: right;
    padding-right: 0.5em;
}

.columns-3 dd {
    display: inline-block;
    margin-left: 0;
}

/* Global focus-visible */
:focus-visible {
    outline: 2px solid var(--myred);
    outline-offset: 2px;
}

.main-header :focus-visible {
    outline-color: var(--myyellow);
}

/* Login form */
.login-container {
    max-width: 420px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--mybackground);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--myborder);
}

.login-container .title {
    text-align: center;
    border-left: none;
    padding-left: 0;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.login-form p {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--mydarkgray);
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--myborder);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    border-color: var(--myred);
    outline: none;
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.1);
}

.login-form .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
    padding: 12px;
    font-size: 1rem;
}

/* Error pages */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--myred);
    margin: 0;
    line-height: 1;
    border-left: none;
    padding-left: 0;
}

.error-page h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1rem 0;
}

.error-page p {
    color: var(--mygray);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Collapsible filter panel */
.filter-details {
    width: 100%;
}

.filter-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.filter-summary::-webkit-details-marker {
    display: none;
}

.filter-summary .subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.filter-summary .subtitle::after {
    content: "▾";
    font-size: 0.8em;
    transition: transform 0.2s;
}

.filter-details:not([open]) .subtitle::after {
    transform: rotate(-90deg);
}

@media (max-width: 768px) {
    .filter-details:not([open]) .filter-container,
    .filter-details:not([open]) .filter-item {
        display: none;
    }

    .filter-details {
        border-top: 1px solid var(--myborder);
        padding-top: 1rem;
    }

    .filter-details:not([open]) {
        padding-bottom: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .side-container {
        width: 100%;
        flex: 1 1 100%;
    }
}
