/* ==========================================================
   mg.drzea.com — Hoja de estilos general
   Paleta tomada del logo corporativo de Mediglobal
   ========================================================== */
:root {
    --mg-blue: #0671b3;
    --mg-blue-dark: #04507f;
    --mg-blue-light: #e8f3fb;
    --mg-green: #7cb342;
    --mg-green-dark: #5c8c2e;
    --mg-orange: #ed8c2f;
    --mg-orange-light: #f2a72d;
    --mg-gray-50: #f7f9fb;
    --mg-gray-100: #eef1f4;
    --mg-gray-200: #dfe4e9;
    --mg-gray-400: #9aa5b1;
    --mg-gray-600: #5b6570;
    --mg-gray-800: #2b3440;
    --mg-red: #d64545;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(6, 113, 179, 0.08);
    --shadow-lg: 0 10px 40px rgba(6, 113, 179, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--mg-gray-50);
    color: var(--mg-gray-800);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--mg-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--mg-gray-800); }
p { margin: 0 0 1em; }
.text-muted { color: var(--mg-gray-600); }
.text-center { text-align: center; }

/* ---------------- Botones ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--mg-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:hover { background: var(--mg-blue-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-green { background: var(--mg-green); }
.btn-green:hover { background: var(--mg-green-dark); }
.btn-orange { background: var(--mg-orange); }
.btn-orange:hover { background: #d97a1e; }
.btn-outline { background: #fff; color: var(--mg-blue); border-color: var(--mg-blue); }
.btn-outline:hover { background: var(--mg-blue-light); color: var(--mg-blue); }
.btn-danger { background: var(--mg-red); }
.btn-danger:hover { background: #b93a3a; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------- Formularios ---------------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--mg-gray-800); }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=tel], input[type=file], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mg-gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--mg-gray-800);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--mg-blue);
    box-shadow: 0 0 0 3px var(--mg-blue-light);
}
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 220px; }
.help-text { font-size: 12px; color: var(--mg-gray-600); margin-top: 4px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-right: 18px; }
.checkbox-inline input { width: auto; }

/* ---------------- Alertas / flash ---------------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e9f6e4; color: #386023; border: 1px solid #b8dfa4; }
.alert-error { background: #fbe9e9; color: #8a2626; border: 1px solid #f0b3b3; }
.alert-info { background: var(--mg-blue-light); color: var(--mg-blue-dark); border: 1px solid #b9dcf0; }

/* ---------------- Tablas ---------------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--mg-gray-100); white-space: nowrap; }
th { background: var(--mg-gray-50); color: var(--mg-gray-600); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-blue { background: var(--mg-blue-light); color: var(--mg-blue-dark); }
.badge-green { background: #e9f6e4; color: var(--mg-green-dark); }
.badge-gray { background: var(--mg-gray-100); color: var(--mg-gray-600); }
.badge-orange { background: #fdecd8; color: #a2590f; }

/* ==========================================================
   LOGIN — panel dividido con carrusel de anuncios
   ========================================================== */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: #fff;
}
.login-ads {
    flex: 1.1;
    position: relative;
    background: linear-gradient(160deg, var(--mg-blue) 0%, var(--mg-blue-dark) 100%);
    color: #fff;
    overflow: hidden;
    display: none;
}
.login-ads .ad-slide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 56px;
    opacity: 0;
    visibility: hidden;
    background-size: cover;
    background-position: center;
}
.login-ads .ad-slide.is-active { opacity: 1; visibility: visible; z-index: 2; }
.login-ads .ad-slide.fx-fade { transition: opacity .9s ease; }
.login-ads .ad-slide.fx-slide { transition: opacity .6s ease, transform .6s ease; transform: translateX(0); }
.login-ads .ad-slide.fx-slide:not(.is-active) { transform: translateX(30px); }
.login-ads .ad-slide.fx-none { transition: none; }
.login-ads .ad-slide::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(0deg, rgba(4,80,127,.88) 0%, rgba(4,80,127,.35) 55%, rgba(4,80,127,.15) 100%);
}
.login-ads .ad-content { position: relative; z-index: 1; max-width: 460px; }
.login-ads .ad-content h2 { font-size: 28px; margin-bottom: 10px; }
.login-ads .ad-content p { font-size: 15px; opacity: .92; }
.login-ads .ad-dots { position: absolute; bottom: 24px; right: 56px; z-index: 3; display: flex; gap: 8px; }
.login-ads .ad-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); display: block; }
.login-ads .ad-dots span.is-active { background: #fff; width: 22px; border-radius: 5px; transition: all .3s; }
.login-ads .ad-brand { position: relative; z-index: 3; padding: 40px 56px 0; }
.login-ads .ad-brand img { height: 34px; }

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #fff;
}
.login-box { width: 100%; max-width: 380px; }
.login-box .brand-mobile { text-align: center; margin-bottom: 28px; }
.login-box .brand-mobile img { height: 40px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .subtitle { color: var(--mg-gray-600); font-size: 14px; margin-bottom: 28px; }
.login-box .btn { margin-top: 6px; }
.login-footer-note { margin-top: 28px; font-size: 12px; color: var(--mg-gray-400); text-align: center; }

@media (min-width: 860px) {
    .login-ads { display: flex; }
}

/* ==========================================================
   DASHBOARD / APP SHELL
   ========================================================== */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--mg-blue-dark) 0%, var(--mg-blue) 100%);
    color: #fff;
    padding: 22px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.app-sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 22px 22px; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 12px; }
.app-sidebar .brand img { height: 26px; background: #fff; border-radius: 6px; padding: 4px 6px; }
.app-sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 22px;
    color: rgba(255,255,255,.85);
    font-size: 14px; font-weight: 500;
}
.app-sidebar nav a:hover, .app-sidebar nav a.is-active { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.app-sidebar .nav-section { padding: 16px 22px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.5); }
.app-sidebar .sidebar-user { padding: 16px 22px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.app-sidebar .sidebar-user strong { display: block; }
.app-sidebar .sidebar-user span { color: rgba(255,255,255,.7); font-size: 12px; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--mg-gray-100);
    position: sticky; top: 0; z-index: 5;
}
.app-topbar h1 { font-size: 19px; margin: 0; }
.app-content { padding: 28px; max-width: 1180px; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; }
.card h3 { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--mg-blue); }
.stat-card .stat-label { font-size: 13px; color: var(--mg-gray-600); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.module-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
    border-top: 4px solid var(--mg-blue); display: block; color: inherit;
}
.module-card:hover { box-shadow: var(--shadow-lg); text-decoration: none; color: inherit; transform: translateY(-2px); transition: .15s; }
.module-card .module-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: var(--mg-blue-light); color: var(--mg-blue);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.mg-icon { flex-shrink: 0; display: block; }
.module-card h4 { margin: 0 0 6px; }
.module-card p { font-size: 13px; color: var(--mg-gray-600); margin: 0; }

@media (max-width: 860px) {
    .app-sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 50; }
    .app-sidebar.is-open { left: 0; }
    .app-content { padding: 18px; }
}

/* ---------------- Diagnósticos (tabla dinámica) ---------------- */
.diag-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.diag-row input:first-child { max-width: 130px; }
.diag-row .btn-remove { flex-shrink: 0; }

/* ---------------- Ad thumbnails admin ---------------- */
.ad-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.ad-admin-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ad-admin-card .ad-thumb { height: 130px; background: var(--mg-gray-100) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--mg-gray-400); font-size: 13px; }
.ad-admin-card .ad-body { padding: 14px; }
.ad-admin-card .ad-actions { display: flex; gap: 8px; margin-top: 10px; }
