:root {
    --bg-color: #ffffff;
    --text-color: #111111;
    --border-color: #eeeeee;
    --brand-green: #2e7d32;
    --link-color: #111111;
    --card-bg: #ffffff;
    --card-border: #e0e0e0;
    --subtext-color: #555555;
    --toast-bg: #111111;
    --toast-text: #ffffff;
}

/* Estilos del Modo Oscuro */
body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --border-color: #2a2a2a;
    --brand-green: #4caf50;
    --link-color: #ffffff;
    --card-bg: #1e1e1e;
    --card-border: #333333;
    --subtext-color: #aaa;
    --toast-bg: #ffffff;
    --toast-text: #111111;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    max-width: 650px;
    margin: 0 auto;
    padding: 40px 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Contenedor del encabezado adaptado para centrar el logo */
.header-top {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 8px;
}

/* Botón de tema posicionado a la derecha para no estorbar el logo */
.header-top .theme-toggle {
    position: absolute;
    right: 0;
    top: 0;
}

/* Logo destacado */
.brand-logo {
    font-family: 'Righteous', cursive;
    color: var(--brand-green);
    font-size: 3.8rem;
    line-height: 1.1;
    display: inline-block;
    cursor: default;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

/* Transición suave para cada letra individual */
.brand-logo .char {
    transition: color 0.3s ease;
}

/* Asignación permanente de los colores de la bandera de Colombia */
.brand-logo .char:nth-child(1),
.brand-logo .char:nth-child(2) {
    color: #FCD116; /* Amarillo (R - e) */
}

.brand-logo .char:nth-child(3),
.brand-logo .char:nth-child(4) {
    color: #003893; /* Azul (u - u) */
}

.brand-logo .char:nth-child(5) {
    color: #CE1126; /* Rojo (z) */
}

.brand-logo:hover {
    transform: scale(1.03);
    text-shadow: none;
}

.brand-green {
    color: var(--brand-green);
}

/* Íconos Lucide */
.icon {
    stroke: var(--brand-green);
    vertical-align: middle;
    margin-right: 6px;
}

header, nav, section, main, footer {
    margin-top: 32px;
    margin-bottom: 32px;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 36px 0;
}

h1 {
    font-weight: 900;
    margin-bottom: 8px;
    margin-top: 0;
}

h2, h3 {
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

p, li {
    font-weight: 400;
    margin-bottom: 12px;
}

ol {
    padding-left: 20px;
}

ol li {
    margin-bottom: 8px;
}

small, .tagline {
    font-weight: 300;
}

a {
    color: var(--link-color);
}

/* Botón de alternar tema y botones generales */
.theme-toggle, .btn-logout {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle:hover, .btn-logout:hover {
    border-color: var(--brand-green);
}

.btn-logout {
    border-color: transparent;
    padding: 0;
    font-size: 14px;
    text-decoration: underline;
    color: var(--text-color);
}

#user-name {
    text-decoration: underline;
}

/* Estilo de la navegación de sesión */
nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.user-badge {
    font-weight: 700;
    color: var(--brand-green);
}

/* Diseños de las tarjetas de donación (Grid Compacta) */
.grid-donaciones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.card-donacion {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--card-bg);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-donacion:hover {
    border-color: var(--brand-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-compacta {
    cursor: pointer;
}

.card-imagen {
    position: relative;
    width: 100%;
    height: 120px;
    background-color: #f0f0f0;
}

.card-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-categoria {
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
    font-weight: 600;
}

.card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.card-titulo {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info-ubicacion {
    font-size: 12px;
    color: var(--subtext-color);
    margin: 0;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-contacto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: #25d366;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    font-size: 13px;
}

.btn-contacto:hover {
    background-color: #128c7e;
}

.sin-contacto {
    font-size: 12px;
    color: var(--subtext-color);
    margin-top: 8px;
    font-style: italic;
}

/* Modal Overlay y Estructura */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: 100%;
    max-width: 490px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-cerrar {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease;
}

.modal-cerrar:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Layout Vertical del Modal */
.modal-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.modal-imagen {
    width: 100%;
    height: 240px;
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.modal-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 20px 20px;
}

.modal-info h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.modal-descripcion {
    font-size: 13.5px;
    color: var(--subtext-color);
    margin: 2px 0 6px 0;
    line-height: 1.45;
}

.modal-meta {
    font-size: 12.5px;
    margin: 0;
    color: var(--text-color);
}

.modal-acciones {
    margin-top: 6px;
}

/* Badges de estado */
.card-donacion .badge-estado {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.badge-estado.disponible {
    background: rgba(220, 252, 231, 0.9);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-estado.no-disponible {
    background: rgba(254, 226, 226, 0.9);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.card-donacion.card-agotada {
    opacity: 0.75;
    filter: grayscale(20%);
    transition: opacity 0.2s ease;
}

.card-donacion.card-agotada:hover {
    opacity: 0.9;
}

.btn-deshabilitado {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background-color: #e2e8f0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
}

/* Estilos del Carrusel Redimensionado */
.carrusel-wrapper {
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    border-radius: 12px;
    max-width: 520px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.carrusel-slides {
    width: 100%;
    height: 280px; 
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.carrusel-slide {
    display: none;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.carrusel-slide.active {
    display: block;
}

.carrusel-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.carrusel-controles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    background-color: var(--card-bg);
}

.carrusel-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.carrusel-btn:hover {
    border-color: var(--brand-green);
    background-color: rgba(46, 125, 50, 0.05);
}

.carrusel-dots {
    display: flex;
    gap: 6px;
}

.carrusel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.carrusel-dot.active {
    background-color: var(--brand-green);
    transform: scale(1.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notificación Toast */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--toast-bg);
    color: var(--toast-text);
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Pie de página */
footer {
    margin-top: 40px;
    margin-bottom: 24px;
    padding-top: 16px;
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    color: var(--text-color);
}

.footer-subtext {
    color: var(--subtext-color);
    font-size: 15px;
}

.sep {
    color: var(--subtext-color);
    opacity: 0.5;
    font-size: 10px;
}

.footer-container a.footer-subtext {
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-container a.footer-subtext:hover {
    color: var(--brand-green);
    text-decoration: underline;
}
