html,
body {
    font-family: 'Poppins', 'Source Sans Pro', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

/* Títulos */
h1, .h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

h2, .h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

h3, .h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

h4, .h4,
h5, .h5,
h6, .h6 {
    font-weight: 600;
}

/* Sidebar */
.nav-sidebar .nav-link,
.nav-sidebar .nav-link p {
    font-size: 0.92rem;
}

.brand-text {
    font-size: 1rem;
    font-weight: 500 !important;
}

/* Botones */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
}

.btn-sm {
    font-size: 0.78rem;
    line-height: 1.3;
}

/* Tablas */
.table {
    font-size: 0.875rem;
}

.table td,
.table th {
    padding: 0.55rem;
    vertical-align: middle;
}

/* Formularios */
.form-control,
.custom-select,
.input-group-text {
    font-size: 0.875rem;
}

.form-control {
    min-height: calc(2.1rem + 2px);
}

/* Cards */
.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-header {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

/* Info boxes */
.info-box {
    min-height: 78px;
}

.info-box .info-box-text {
    font-size: 0.82rem;
}

.info-box .info-box-number {
    font-size: 1rem;
    font-weight: 600;
}

/* DataTables */
.dataTables_wrapper,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    font-size: 0.875rem;
}

/* Badges */
.badge {
    font-weight: 500;
}

/* ==========================================================
   Mejoras móviles para votaciones
   ========================================================== */

@media (max-width: 767.98px) {

    html,
    body {
        font-size: 15px;
    }

    .content-wrapper {
        background: #f4f6f9;
    }

    .content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .container-fluid {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .content-header {
        padding: 0.85rem 0 0.35rem 0;
    }

    .content-header h1,
    .content-header .m-0.text-dark {
        font-size: 1.45rem;
        line-height: 1.25;
        font-weight: 600;
        margin-bottom: 0.35rem;
    }

    .breadcrumb {
        display: none;
    }

    .card {
        border-radius: 0.85rem;
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.9rem 1rem;
    }

    .card-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .card-body {
        padding: 1rem;
    }

    .main-footer {
        font-size: 0.9rem;
        line-height: 1.5;
        padding: 1rem;
    }

    .main-header .nav-link {
        min-height: 3rem;
        display: flex;
        align-items: center;
    }
}

/* ==========================================================
   Listado de votaciones en móvil
   ========================================================== */

@media (max-width: 767.98px) {

    .page-vote-list .dataTables_wrapper > .row:first-child {
        display: none;
    }

    .page-vote-list table.dataTable {
        border: 0 !important;
        width: 100% !important;
    }

    .page-vote-list #example2 thead,
    .page-vote-list #example2 tfoot {
        display: none !important;
    }

    .page-vote-list #example2 tbody,
    .page-vote-list #example2 tr,
    .page-vote-list #example2 td {
        display: block;
        width: 100% !important;
    }

    .page-vote-list #example2 tbody tr {
        background: #ffffff;
        border: 1px solid #dee2e6;
        border-radius: 0.85rem;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .page-vote-list #example2 tbody td {
        border: 0 !important;
        padding: 0 !important;
    }

    /*
       Título de la votación.
       En móvil usamos la primera celda visible como título.
       No ocultamos td:first-child porque DataTables ya oculta la columna ID.
    */
    .page-vote-list #example2 tbody td:first-child {
        display: block !important;
        font-size: 1.12rem;
        font-weight: 600;
        line-height: 1.35;
        color: #212529;
        margin-bottom: 0.95rem;
    }

    /*
       Acciones.
       Usamos la última celda para que funcione aunque DataTables oculte columnas.
    */
    .page-vote-list #example2 tbody td:last-child {
        display: flex !important;
        flex-direction: column;
        gap: 0.55rem;
    }

    .page-vote-list #example2 tbody td:last-child .btn,
    .page-vote-list #example2 tbody td:last-child .btn-group,
    .page-vote-list #example2 tbody td:last-child form {
        width: 100%;
        display: block !important;
        margin: 0 !important;
    }

    .page-vote-list #example2 tbody td:last-child .btn,
    .page-vote-list #example2 tbody td:last-child button {
        width: 100%;
        min-height: 3.4rem;
        border-radius: 0.55rem;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: normal;
        padding-top: 0;
        padding-bottom: 0;
    }

    .page-vote-list #example2 tbody td:last-child .btn i {
        margin-left: 0.45rem;
        line-height: 1;
        display: inline-flex;
        align-items: center;
    }

    .page-vote-list .dataTables_info {
        font-size: 0.95rem;
        text-align: center;
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .page-vote-list .dataTables_paginate .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    .page-vote-list .dataTables_paginate .page-link {
        min-height: 2.6rem;
        display: flex;
        align-items: center;
    }
}

/* ==========================================================
   Página de emisión de voto en móvil
   ========================================================== */

@media (max-width: 767.98px) {

    .page-vote-form .card {
        border-radius: 0.9rem;
    }

    .page-vote-form .card-header,
    .page-vote-form .card-body {
        padding: 1rem;
    }

    .page-vote-form h1,
    .page-vote-form h2,
    .page-vote-form h3 {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    .page-vote-form label {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .page-vote-form select,
    .page-vote-form .form-control,
    .page-vote-form .custom-select {
        min-height: 3.4rem;
        font-size: 1rem;
        border-radius: 0.55rem;
    }

    .page-vote-form .btn,
    .page-vote-form button[type="submit"],
    .page-vote-form input[type="submit"] {
        width: 100%;
        min-height: 3.4rem;
        font-size: 1.05rem;
        font-weight: 600;
        border-radius: 0.55rem;
        margin-top: 0.5rem;
    }

    .page-vote-form .alert {
        font-size: 0.95rem;
        line-height: 1.45;
    }
}

/* ==========================================================
   Resultados en móvil
   ========================================================== */

@media (max-width: 767.98px) {

    .page-vote-results .presentation-title {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    .page-vote-results .presentation-description {
        font-size: 1rem;
        line-height: 1.4;
    }

    .page-vote-results .results-actions .btn {
        width: 100%;
        min-height: 3rem;
        margin: 0 0 0.5rem 0;
        font-size: 1rem;
        font-weight: 600;
    }

    .page-vote-results .info-box {
        min-height: 5.2rem;
        border-radius: 0.75rem;
    }

    .page-vote-results .info-box-icon {
        width: 4rem;
        font-size: 1.45rem;
    }

    .page-vote-results .info-box-text {
        font-size: 0.9rem;
    }

    .page-vote-results .info-box-number {
        font-size: 1.05rem;
    }

    .page-vote-results #donutChart {
        min-height: 320px !important;
        height: 320px !important;
        max-height: 320px !important;
    }

    .page-vote-results .table {
        font-size: 0.9rem;
    }

    .page-vote-results .badge-list .badge {
        font-size: 0.85rem;
        padding: 0.45rem 0.55rem;
    }
}

/* ==========================================================
   Corrección global de alineación vertical en botones
   ========================================================== */

.btn,
button.btn,
a.btn,
input.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    line-height: 1.15;
    vertical-align: middle;
}

.btn i,
button.btn i,
a.btn i {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Evita que los botones pequeños se deformen */
.btn-sm {
    gap: 0.25rem;
    line-height: 1.1;
}

/* Botones circulares/icon-only: no forzar gap ni tamaños raros */
.btn-circle,
.btn-icon,
.btn[class*="btn-outline"].btn-circle {
    gap: 0;
}

/* En móvil, hacer los botones principales más cómodos */
@media (max-width: 767.98px) {
    .btn,
    button.btn,
    a.btn {
        min-height: 2.75rem;
    }

    .btn-sm {
        min-height: 2.35rem;
    }

    .page-vote-list #example2 tbody td:last-child .btn,
    .page-vote-list #example2 tbody td:last-child button,
    .page-vote-form .btn,
    .page-vote-form button[type="submit"],
    .page-vote-form input[type="submit"],
    .page-vote-results .results-actions .btn {
        min-height: 3.4rem;
        font-size: 1rem;
        font-weight: 600;
    }
}