/* css/admin.css */

/* Reset básico */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body.ml-body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f9fafb;
}

/* Para que footer quede abajo */
.ml-body--gradient,
.ml-body--dashboard {
    display: flex;
    flex-direction: column;
}

/* Gradiente principal tipo Flutter */
.ml-body--gradient {
    background: radial-gradient(circle at top left, #f2d42b 0, #4338ca 28%, #050816 72%);
}

/* Para el dashboard, un poco más sobrio */
.ml-body--dashboard {
    background: #050816;
}

/* ===========================
   LOGIN LAYOUT
   =========================== */

.ml-auth-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ml-auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 23, 42, 0.96);
    border-radius: 24px;
    padding: 28px 24px 24px;
    box-shadow:
        0 18px 60px rgba(0, 0, 0, .5),
        0 0 0 1px rgba(148, 163, 184, 0.15);
    backdrop-filter: blur(18px);
}

.ml-auth-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.ml-logo-circle {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f2d42b, #f97316);
    color: #050816;
    box-shadow: 0 8px 26px rgba(0,0,0,.35);
}

.ml-logo-circle--small {
    width: 40px;
    height: 40px;
    font-size: 0.75rem;
}

/* Imagen dentro del círculo de logo */
.ml-logo-circle img,
.ml-logo-img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    display: block;
}

.ml-auth-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.ml-auth-subtitle {
    margin: 2px 0 0;
    font-size: .85rem;
    color: #9ca3af;
}

.ml-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ml-field label {
    display: block;
    font-size: .8rem;
    margin-bottom: 4px;
    color: #9ca3af;
}

.ml-input-icon {
    position: relative;
}

.ml-input-icon input {
    width: 100%;
    padding: 10px 12px 10px 34px;
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #f9fafb;
    font-size: .9rem;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.ml-input-icon input::placeholder {
    color: #6b7280;
}

.ml-input-icon input:focus {
    border-color: #f2d42b;
    box-shadow: 0 0 0 1px rgba(242, 212, 43, 0.4);
    background: #020617;
}

.ml-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .9rem;
    color: #9ca3af;
}

.ml-btn {
    border-radius: 999px;
    padding: 10px 18px;
    border: none;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}

.ml-btn--primary {
    background: linear-gradient(135deg, #f2d42b, #f97316);
    color: #050816;
    box-shadow: 0 10px 26px rgba(0,0,0,.45);
}

.ml-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(0,0,0,.5);
}

.ml-btn--ghost {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid #4b5563;
}

.ml-btn--ghost:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: #9ca3af;
}

.ml-btn--small {
    padding: 6px 12px;
    font-size: .8rem;
}

/* Alertas */
.ml-alert {
    border-radius: 14px;
    padding: 8px 12px;
    font-size: .8rem;
}

.ml-alert--error {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.4);
}

.ml-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: .8rem;
    margin-top: 4px;
}

.ml-divider::before,
.ml-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #4b5563);
}

/* ===========================
   MODAL SOLICITAR ACCESO
   =========================== */

.ml-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.ml-modal[aria-hidden="false"] {
    display: flex;
}

.ml-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
}

.ml-modal-content {
    position: relative;
    max-width: 420px;
    width: 100%;
    background: #020617;
    border-radius: 24px;
    padding: 20px 18px 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,.6);
    border: 1px solid rgba(148, 163, 184, 0.35);
    z-index: 1;
}

.ml-modal h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.ml-modal-text {
    margin: 0 0 14px;
    font-size: .8rem;
    color: #9ca3af;
}

.ml-modal textarea,
.ml-modal input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #f9fafb;
    padding: 8px 10px;
    font-size: .85rem;
    outline: none;
    resize: vertical;
}

.ml-modal input:focus,
.ml-modal textarea:focus {
    border-color: #f2d42b;
    box-shadow: 0 0 0 1px rgba(242, 212, 43, 0.4);
}

.ml-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.ml-no-scroll {
    overflow: hidden;
}

/* ===========================
   DASHBOARD
   =========================== */

.ml-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(31, 41, 55, 0.85);
}

.ml-topbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ml-topbar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ml-topbar-subtitle {
    margin: 0;
    font-size: .75rem;
    color: #9ca3af;
}

.ml-topbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ml-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .8rem;
    color: #e5e7eb;
    border: 1px solid rgba(55, 65, 81, 0.9);
}

.ml-user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #f2d42b);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    color: #050816;
}

/* Layout principal */
.ml-dashboard-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.ml-sidebar {
    border-right: 1px solid rgba(31, 41, 55, 0.9);
    background: radial-gradient(circle at top, #111827, #020617 60%);
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ml-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ml-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: .85rem;
    color: #9ca3af;
}

.ml-menu-icon {
    font-size: 1rem;
}

.ml-menu-item--active {
    background: linear-gradient(135deg, rgba(242, 212, 43, 0.12), rgba(88, 28, 135, 0.4));
    color: #f9fafb;
}

.ml-sidebar-footer {
    font-size: .7rem;
    color: #6b7280;
    padding: 0 4px;
}

/* Main */
.ml-dashboard-main {
    padding: 18px 18px 24px;
    overflow-x: hidden;
}

.ml-hero-card {
    border-radius: 20px;
    padding: 16px 16px 14px;
    background: radial-gradient(circle at top left, rgba(242, 212, 43, 0.12), rgba(55, 48, 163, 0.65));
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.85);
    margin-bottom: 18px;
}

.ml-hero-card h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.ml-hero-card p {
    margin: 0;
    font-size: .8rem;
    color: #e5e7eb;
}

/* Tarjetas de stats */
.ml-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.ml-stat-card {
    background: #020617;
    border-radius: 18px;
    padding: 12px 12px 10px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .6);
}

.ml-stat-card h3 {
    margin: 0 0 4px;
    font-size: .85rem;
    color: #e5e7eb;
}

.ml-stat-number {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f2d42b;
}

.ml-stat-label {
    margin: 2px 0 0;
    font-size: .75rem;
    color: #9ca3af;
}

/* Paneles */
.ml-panels-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr);
    gap: 16px;
    margin-top: 8px;
}

.ml-panel {
    background: #020617;
    border-radius: 18px;
    padding: 12px 12px 10px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .7);
    display: flex;
    flex-direction: column;
}

.ml-panel-header h3 {
    margin: 0 0 2px;
    font-size: .9rem;
}

.ml-panel-header p {
    margin: 0 0 10px;
    font-size: .75rem;
    color: #9ca3af;
}

/* Tablas */
.ml-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.ml-table-wrapper--scroll {
    max-height: 320px;
    overflow-y: auto;
}

.ml-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.ml-table thead {
    background: #020617;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ml-table th,
.ml-table td {
    padding: 7px 6px;
    border-bottom: 1px solid #111827;
    text-align: left;
}

.ml-table th {
    font-weight: 600;
    color: #9ca3af;
    font-size: .75rem;
}

.ml-table tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.7);
}

.ml-table-url {
    max-width: 260px;
    word-break: break-all;
}

/* ===========================
   FOOTER
   =========================== */

.ml-footer {
    padding: 6px 18px;
    background: #111827;
    border-top: 1px solid #1f2937;
    font-size: .75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ml-footer-left {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ml-footer-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #9ca3af;
    font-size: .75rem;
}

.ml-footer-right span {
    border-bottom: 1px solid transparent;
    transition: border-color .15s ease, color .15s ease;
}

.ml-footer-logo {
    height: 20px;
    width: auto;
    opacity: .85;
    transition: transform .15s ease, opacity .15s ease;
    display: block;
}

.ml-footer-right:hover span {
    color: #e5e7eb;
    border-color: #e5e7eb;
}

.ml-footer-right:hover .ml-footer-logo {
    opacity: 1;
    transform: scale(1.04);
}

/* Responsive */
@media (max-width: 900px) {
    .ml-dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ml-sidebar {
        display: none;
    }

    .ml-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ml-panels-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .ml-auth-card {
        padding: 20px 16px 18px;
    }

    .ml-stats-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .ml-topbar {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .ml-dashboard-main {
        padding: 14px 14px 18px;
    }

    .ml-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
