/* ===== ADMIN PANEL ===== */

/* ===== HERO / ENCABEZADO DE PÁGINA ===== */
.admin-hero {
    padding: 36px 0;
}

.admin-hero .content-wrapper {
    max-width: 1400px;
}

.admin-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.admin-hero-title {
    margin: 4px 0 6px;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    color: #fff;
}

.admin-hero-sub {
    margin: 0;
    max-width: 560px;
}

.admin-hero-logo {
    flex-shrink: 0;
    width: 176px;
    height: 176px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.3);
}

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

@media (max-width: 900px) {
    .admin-hero-logo {
        width: 110px;
        height: 110px;
        padding: 14px;
    }
}

@media (max-width: 640px) {
    .admin-hero-logo {
        display: none;
    }
}

.admin-main {
    padding: 40px 0 60px;
    min-height: calc(100vh - 280px);
}

.admin-main .content-wrapper {
    max-width: 1400px;
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 8px 6px;
}

.topbar-user i {
    color: var(--accent);
    font-size: 1.2rem;
}

/* ===== STAT CARDS ===== */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 6px 20px rgba(15,23,42,0.08);
    border-left: 4px solid var(--accent);
}

.stat-card i {
    font-size: 1.8rem;
    color: var(--accent);
    width: 44px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ===== CARD / TABLE SECTION ===== */
.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(15,23,42,0.08);
    margin-bottom: 32px;
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #eef0f4;
}

.admin-card-heading {
    min-width: 0;
}

.admin-card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(242,101,34,0.1);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.admin-card-header h2 {
    margin: 0;
    text-align: left;
    font-size: 1.2rem;
    animation: none;
    opacity: 1;
}

.admin-card-header h2 .badge {
    vertical-align: middle;
    margin-left: 4px;
}

.admin-card-sub {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

/* ===== ACTION BUTTONS (avoid clashing with the public site's global .btn override) ===== */
.admin-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-action-btn:hover,
.admin-action-btn:focus {
    background: var(--accent);
    color: #fff;
}

.admin-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #cfd8e3;
    background: #fff;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-icon-btn:hover,
.admin-icon-btn:focus {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== MODAL (Agregar / Editar Usuario) ===== */
#userModal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(10,37,64,0.35);
}

#userModal .modal-header {
    background: var(--primary);
    color: #fff;
    border-bottom: none;
    padding: 22px 24px;
    align-items: center;
}

.modal-header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-header-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

#userModal .modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

.modal-header-sub {
    margin: 3px 0 0;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
}

#userModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#userModal .modal-body {
    padding: 26px 24px 8px;
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    border-bottom: 1px solid #eef0f4;
    padding-bottom: 8px;
    margin: 4px 0 16px;
}

.modal-section-title:not(:first-child) {
    margin-top: 22px;
}

.modal-section-title i {
    color: var(--accent);
}

#userModal .form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
}

#userModal .form-label i {
    color: var(--accent);
    width: 16px;
    text-align: center;
}

#userModal .form-control {
    border-radius: 10px;
    background: #fbfcfe;
}

#userModal .form-control:focus,
#userModal .form-check-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(30,31,62,0.15);
}

.modal-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 14px;
    height: 100%;
}

.modal-switch .form-check-input {
    width: 2.4em;
    cursor: pointer;
}

.modal-switch .form-check-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
}

#userModal .modal-footer {
    background: #fafbfc;
    border-top: 1px solid #eef0f4;
    padding: 18px 24px;
}

#userFormError {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 12px 22px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.modal-btn-primary {
    background: var(--primary);
    color: #fff;
}

.modal-btn-primary:hover:not(:disabled),
.modal-btn-primary:focus:not(:disabled) {
    background: var(--accent);
    color: #fff;
}

.modal-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.modal-btn-cancel {
    background: transparent;
    color: var(--muted);
    border-color: #cfd8e3;
}

.modal-btn-cancel:hover,
.modal-btn-cancel:focus {
    background: #f3f6fa;
    color: var(--primary);
}

.admin-table-wrapper {
    padding: 18px 24px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead th {
    background: var(--primary);
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.admin-table thead th i {
    color: var(--accent);
    margin-right: 6px;
}

.admin-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #eef0f4;
    font-size: 0.92rem;
    vertical-align: middle;
}

.admin-table.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #f8fafc;
}

.admin-table tbody tr:hover {
    background: #f0f4fa;
}

.admin-table .admin-msg {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== DataTables (Bootstrap) integration ===== */
.dataTables_wrapper .dt-buttons {
    margin-bottom: 8px;
}

.dt-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1b8a3d;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dt-export-btn:hover,
.dt-export-btn:focus {
    background: #146b2e;
    color: #fff;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(30,31,62,0.15);
}

.dataTables_wrapper .page-link {
    color: var(--primary);
}

.dataTables_wrapper .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

.dataTables_wrapper .page-link:hover {
    color: var(--accent);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter label {
    color: var(--muted);
    font-size: 0.88rem;
}

.admin-empty {
    text-align: center;
    color: var(--muted);
    padding: 32px 16px !important;
    font-size: 0.95rem;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-yes { background: #e3f7e8; color: #1b8a3d; }
.badge-no { background: #fdeaea; color: #c0392b; }
.badge-muted { background: #eef0f4; color: var(--muted); }
.badge-role { background: #eaf1fb; color: var(--primary); }

/* ===== AVATAR ===== */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--muted);
    font-size: 1rem;
}

/* ===== LOGIN PAGE ===== */
.login-body {
    background: linear-gradient(160deg, var(--primary) 0%, #2a2c5e 55%, var(--primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.login-wrap {
    width: 100%;
    padding: 24px;
    display: flex;
    justify-content: center;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand img {
    height: 56px;
    margin-bottom: 12px;
}

.login-brand h1 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 4px;
}

.login-brand p {
    color: var(--muted);
    margin: 0;
    font-size: 0.92rem;
}

.login-alert {
    background: #fdeaea;
    color: #c0392b;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-group {
    margin-bottom: 18px;
}

.login-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 0.92rem;
}

.login-group label i {
    color: var(--accent);
    width: 16px;
    text-align: center;
}

.login-group input {
    width: 100%;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    padding: 13px 16px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.login-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 4px rgba(10, 37, 64, 0.4);
}

.login-btn {
    width: 100%;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 14px 20px;
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.login-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.login-back {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--muted);
    font-size: 0.88rem;
}

.login-back:hover {
    color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-table-wrapper {
        padding: 14px 12px 18px;
    }
}
