/* ==========================================================================
   Admin panel — Cooperativa Leones
   ========================================================================== */

:root {
    --admin-sidebar-width: 260px;
    --admin-bg: #eef1f4;
    --admin-surface: #ffffff;
    --admin-border: #e2e8f0;
    --admin-green: #1b3d2f;
    --admin-green-light: #2d6a4f;
    --admin-content-x: 1.75rem;
    --admin-content-y: 1.5rem;
    --admin-radius: 0.75rem;
    --admin-shadow: 0 0.125rem 0.75rem rgba(15, 23, 42, 0.06);
}

.admin-body {
    background: var(--admin-bg);
    min-height: 100vh;
    color: #1f2937;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar
   -------------------------------------------------------------------------- */

.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-green);
    color: #fff;
    flex-shrink: 0;
}

.admin-sidebar__brand {
    padding: 1.35rem 1.25rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-sidebar__brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    display: block;
    font-size: 1.05rem;
}

.admin-sidebar__brand small {
    color: rgba(255, 255, 255, 0.65);
    display: block;
    margin-top: 0.15rem;
}

.admin-sidebar__nav {
    padding: 1rem 0.85rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.admin-sidebar__label {
    margin: 1rem 0.65rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.admin-sidebar__label:first-child {
    margin-top: 0.25rem;
}

.admin-sidebar__nav a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.95rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-sidebar__nav a:hover,
.admin-sidebar__nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Main area
   -------------------------------------------------------------------------- */

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--admin-bg);
}

.admin-main--guest {
    align-items: center;
    justify-content: center;
}

.admin-main--guest .admin-content {
    width: 100%;
    max-width: 440px;
    padding: 2rem var(--admin-content-x);
}

.admin-topbar {
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    padding: 1.1rem var(--admin-content-x);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.admin-topbar__title h1 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.admin-topbar__title p {
    margin: 0.2rem 0 0;
}

.admin-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    padding: var(--admin-content-y) var(--admin-content-x) 2rem;
    width: 100%;
    max-width: 1400px;
}

/* Alerts
   -------------------------------------------------------------------------- */

.admin-content > .alert {
    margin-bottom: 1.25rem;
}

/* Page sections
   -------------------------------------------------------------------------- */

.admin-page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 0.15rem 0;
}

.admin-page-toolbar p {
    margin: 0;
}

/* Cards
   -------------------------------------------------------------------------- */

.admin-content .card {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.admin-content .card.border-0 {
    border-color: var(--admin-border) !important;
}

.admin-content .card-body {
    padding: 1.35rem 1.5rem;
}

.admin-content .card-header {
    padding: 1rem 1.5rem;
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    font-weight: 600;
}

.admin-content .card-footer {
    padding: 1rem 1.5rem;
    background: var(--admin-surface);
    border-top: 1px solid var(--admin-border);
}

.admin-content .card + .card,
.admin-content .card + form.card,
.admin-content form.card + .card {
    margin-top: 1.25rem;
}

/* Tables inside cards
   -------------------------------------------------------------------------- */

.admin-content .card > .table-responsive > .table,
.admin-content .card > .table {
    margin-bottom: 0;
}

.admin-content .card > .table-responsive > .table > :not(caption) > * > *,
.admin-content .card > .table > :not(caption) > * > * {
    padding: 0.85rem 1.5rem;
    vertical-align: middle;
}

.admin-content .card > .table-responsive > .table > thead > tr > th,
.admin-content .card > .table > thead > tr > th {
    padding-top: 1rem;
    padding-bottom: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom-width: 1px;
}

.admin-content .pagination {
    margin-top: 1.25rem;
    margin-bottom: 0;
}

/* Table action buttons
   -------------------------------------------------------------------------- */

.admin-content .table .admin-table-actions-col {
    width: 1%;
    white-space: nowrap;
}

.admin-table-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.admin-table-actions form {
    margin: 0;
    display: inline-flex;
}

.admin-table-actions .btn {
    white-space: nowrap;
}

.admin-mensaje-row {
    cursor: pointer;
}

/* Mensaje detail modal
   -------------------------------------------------------------------------- */

.admin-mensaje-modal .modal-content {
    border-radius: var(--admin-radius);
    box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.admin-mensaje-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, var(--admin-green) 0%, var(--admin-green-light) 100%);
    color: #fff;
}

.admin-mensaje-modal__profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.admin-mensaje-modal__avatar {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.28);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.04em;
}

.admin-mensaje-modal__profile-text {
    min-width: 0;
}

.admin-mensaje-modal__profile-text .modal-title {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
}

.admin-mensaje-modal__fecha {
    margin-top: 0.2rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.875rem;
}

.admin-mensaje-modal__body {
    padding: 1.35rem 1.5rem 1.5rem;
    background: var(--admin-bg);
}

.admin-mensaje-modal__tile {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    height: 100%;
    padding: 1rem 1.1rem;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 0.65rem;
    box-shadow: var(--admin-shadow);
}

.admin-mensaje-modal__tile-icon {
    flex-shrink: 0;
    width: 2.35rem;
    height: 2.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: rgba(45, 106, 79, 0.1);
    color: var(--admin-green-light);
    font-size: 1.05rem;
}

.admin-mensaje-modal__tile-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.admin-mensaje-modal__tile-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.45;
    word-break: break-word;
}

.admin-mensaje-modal__tile-value a {
    color: var(--admin-green-light);
    text-decoration: none;
}

.admin-mensaje-modal__tile-value a:hover {
    color: var(--admin-green);
    text-decoration: underline;
}

.admin-mensaje-modal__empty {
    color: #94a3b8;
    font-weight: 400;
    font-style: italic;
}

.admin-mensaje-modal__mensaje {
    margin-top: 1.25rem;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 0.65rem;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.admin-mensaje-modal__mensaje-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--admin-border);
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.admin-mensaje-modal__mensaje-head i {
    color: var(--admin-green-light);
    font-size: 1rem;
}

.admin-mensaje-modal__mensaje-texto {
    padding: 1.1rem 1.15rem;
    max-height: 18rem;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
}

/* Pagination
   -------------------------------------------------------------------------- */

.admin-pagination {
    margin-top: 1.25rem;
}

.admin-pagination .pagination {
    margin-bottom: 0;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.admin-pagination .page-link {
    border-radius: 0.375rem;
    min-width: 2.25rem;
    text-align: center;
}

/* Dashboard cards
   -------------------------------------------------------------------------- */

.admin-card-link {
    display: block;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    padding: 1.35rem 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--admin-shadow);
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.admin-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.1);
    border-color: #cbd5e1;
    color: inherit;
}

.admin-card-link i {
    font-size: 1.6rem;
    color: var(--admin-green-light);
    display: block;
    margin-bottom: 0.85rem;
}

.admin-card-link strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.admin-card-link span {
    display: block;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.45;
}

/* Forms
   -------------------------------------------------------------------------- */

.admin-content .form-label {
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #374151;
}

.admin-content .form-control,
.admin-content .form-select {
    border-color: #cbd5e1;
    padding: 0.55rem 0.85rem;
}

.admin-content .form-control:focus,
.admin-content .form-select:focus {
    border-color: var(--admin-green-light);
    box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.15);
}

.admin-content .btn-success {
    background-color: var(--admin-green-light);
    border-color: var(--admin-green-light);
}

.admin-content .btn-success:hover {
    background-color: #245a42;
    border-color: #245a42;
}

/* Login
   -------------------------------------------------------------------------- */

.admin-login-card .card-body {
    padding: 2rem 1.75rem !important;
}

/* DataTables
   -------------------------------------------------------------------------- */

.admin-content .dataTables_wrapper {
    padding: 1.25rem 1.5rem 1.5rem;
}

.admin-content .dataTables_wrapper > .row {
    align-items: center;
    margin-bottom: 1rem;
    --bs-gutter-x: 1rem;
}

.admin-content .dataTables_length {
    padding-left: 0.15rem;
    margin-bottom: 0.5rem;
}

.admin-content .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
    color: #374151;
}

.admin-content .dataTables_length select {
    display: inline-block;
    width: auto;
    min-width: 4.75rem;
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    background-color: #fff;
    background-position: right 0.6rem center;
    background-size: 12px 9px;
}

.admin-content .dataTables_length select.form-select-sm {
    min-width: 4.75rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    padding-left: 0.75rem;
    padding-right: 2rem;
    line-height: 1.4;
}

.admin-content .dataTables_filter {
    padding-right: 0.15rem;
    margin-bottom: 0.5rem;
    text-align: right;
}

.admin-content .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
    color: #374151;
}

.admin-content .dataTables_filter input {
    display: inline-block;
    width: auto;
    min-width: 14rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    margin-left: 0 !important;
}

.admin-content .dataTables_filter input.form-control-sm {
    min-height: calc(1.5em + 0.9rem + 2px);
    padding: 0.45rem 0.85rem;
    font-size: 0.9375rem;
}

.admin-content .dataTables_filter input:focus,
.admin-content .dataTables_length select:focus {
    border-color: var(--admin-green-light);
    box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.15);
    outline: 0;
}

.admin-content .dataTables_info {
    color: #64748b;
    font-size: 0.875rem;
    padding-top: 0.85rem;
}

.admin-content .dataTables_paginate {
    padding-top: 0.85rem;
}

.admin-content .dataTables_paginate .page-link {
    border-radius: 0.375rem;
    margin-left: 0.2rem;
}

.admin-content table.dataTable thead > tr > th {
    border-bottom: 1px solid var(--admin-border);
}

.admin-content .card.table-responsive .dataTables_wrapper,
.admin-content .card .table-responsive .dataTables_wrapper {
    padding: 1.25rem 1.5rem 1.5rem;
}

@media (min-width: 768px) {
    .admin-content .dataTables_length {
        margin-bottom: 0;
    }

    .admin-content .dataTables_filter {
        margin-bottom: 0;
    }

    .admin-content .dataTables_filter input {
        min-width: 16rem;
    }
}

/* Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    :root {
        --admin-content-x: 1.15rem;
        --admin-content-y: 1.15rem;
    }

    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
    }

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-topbar__actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 575.98px) {
    .admin-content .card > .table-responsive > .table > :not(caption) > * > *,
    .admin-content .card > .table > :not(caption) > * > * {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .admin-page-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Galería de imágenes de notas ── */
.nota-img-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0.6rem;
    overflow: hidden;
    background: #fff;
}

.nota-img-card__thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f3f5;
}

.nota-img-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nota-img-card__badge {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: 1rem;
    background: rgba(25, 135, 84, 0.95);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.nota-img-card__caption {
    padding: 0.5rem 0.6rem 0;
    font-size: 0.78rem;
    color: #6c757d;
}

.nota-img-card__actions {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem;
    margin-top: auto;
}

.nota-img-card__actions form {
    margin: 0;
}

.nota-img-card__actions form:first-child {
    flex: 1;
}

.nota-img-card__actions form:first-child .btn {
    width: 100%;
}
