/* ==========================================================================
   MenuCloud — Sistema de diseño (core.css)
   Tokens, reset, utilidades. Mobile First.
   ========================================================================== */

:root {
    --color-primary: #0d6efd;
    --color-primary-dark: #0b5ed7;
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-2: #273449;
    --color-border: #334155;
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #38bdf8;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .25);
    --space: 1rem;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-info); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 700; }

/* Layout helpers */
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1rem; }
.grid { display: grid; gap: 1rem; }
.flex { display: flex; gap: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { flex-direction: column; }
.gap-sm { gap: .5rem; }
.wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-muted { color: var(--color-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.card-title { font-size: 1.05rem; margin-bottom: 1rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .6rem 1.1rem; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: .95rem; font-weight: 600; cursor: pointer; transition: .15s; background: var(--color-surface-2);
    color: var(--color-text); text-decoration: none;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-success { background: var(--color-success); color: #04230f; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--color-border); }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .85rem; color: var(--color-muted); font-weight: 600; }
.form-control, .form-select, textarea.form-control {
    width: 100%; padding: .65rem .8rem; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text);
    font-size: .95rem; font-family: inherit;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13,110,253,.25);
}
.form-error { color: var(--color-danger); font-size: .8rem; margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* Badges */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-success { background: rgba(34,197,94,.15); color: var(--color-success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--color-warning); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--color-danger); }
.badge-info { background: rgba(56,189,248,.15); color: var(--color-info); }
.badge-muted { background: rgba(148,163,184,.15); color: var(--color-muted); }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; font-size: .9rem; }
.alert-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-info { background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.3); color: #7dd3fc; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .7rem .6rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { color: var(--color-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.1rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; }
.stat-label { color: var(--color-muted); font-size: .82rem; }

/* Toast */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; max-width: calc(100vw - 2rem); }
.toast { padding: .8rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); color: #fff; font-size: .9rem; animation: toastIn .2s ease; word-break: break-word; }
.toast-success { background: var(--color-success); }
.toast-danger { background: var(--color-danger); }
.toast-info { background: var(--color-info); color: #04293a; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; z-index: 1000; }
.modal-backdrop.open { display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: .5rem; }

/* Spinner */
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
