/* =====================================================================
   Creveto AR - common.css
   Brand tokens + reusable UI: toast, modal, skeleton, dropzone, badges,
   progress, buttons, inputs. Loaded on every page.
   ===================================================================== */

:root {
    /* Brand */
    --teal: #118174;
    --teal-dark: #0e6f60;
    --teal-50: #e6f4f1;
    --orange: #F7AA47;
    --orange-dark: #d68f2f;

    /* Neutrals */
    --dark: #111111;
    --dark-2: #1A1A1A;
    --bg: #F7F8FA;
    --bg-2: #FFFFFF;
    --text: #111111;
    --muted: #6B7280;
    --border: #E5E7EB;

    /* States */
    --success: #16A34A;
    --error: #DC2626;
    --warning: #F59E0B;
    --info: #3B82F6;

    /* Shape */
    --r-card: 16px;
    --r-btn: 12px;
    --r-input: 12px;
    --shadow-soft: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-hover: 0 12px 36px rgba(0,0,0,0.12);

    /* Type */
    --font-ui: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --font-head: 'Poppins', var(--font-ui);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-ui);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }
img { max-width: 100%; display: block; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border: 0; border-radius: var(--r-btn);
    background: var(--teal); color: #fff; font-weight: 600; font-size: 14px;
    font-family: inherit; cursor: pointer; transition: .2s;
    min-height: 44px; text-decoration: none;
}
.btn:hover { background: var(--teal-dark); transform: translateY(-1px); }
.btn.orange { background: var(--orange); }
.btn.orange:hover { background: var(--orange-dark); }
.btn.ghost { background: transparent; color: var(--teal); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--teal-50); }
.btn.danger { background: var(--error); }
.btn.subtle { background: var(--bg); color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 12px; min-height: 32px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Inputs ---------- */
.input, select.input, textarea.input {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border);
    border-radius: var(--r-input); font-size: 14px; font-family: inherit;
    background: #fff; color: var(--text); transition: .2s;
}
.input:focus, select.input:focus, textarea.input:focus {
    outline: none; border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(17,129,116,.15);
}
label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--muted); margin: 0 0 6px; text-transform: uppercase;
    letter-spacing: .5px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-2); border-radius: var(--r-card);
    box-shadow: var(--shadow-soft); padding: 22px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge.active   { background: #dcfce7; color: var(--success); }
.badge.locked   { background: #fef3c7; color: #92400e; }
.badge.expired  { background: #fee2e2; color: var(--error); }
.badge.draft    { background: #f3f4f6; color: var(--muted); }
.badge.info     { background: var(--teal-50); color: var(--teal); }
.badge.limit    { background: #fef3c7; color: var(--warning); }

/* ---------- Progress ---------- */
.progress { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); transition: width .6s ease; }
.progress.warn > span { background: var(--warning); }
.progress.danger > span { background: var(--error); }
.progress.unlimited > span { background: linear-gradient(90deg, var(--success), #34d399); width: 100%; }

/* ---------- Toast ---------- */
#toast-host {
    position: fixed; top: 18px; right: 18px; z-index: 99999;
    display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
    background: #111; color: #fff; padding: 12px 16px;
    border-radius: 10px; box-shadow: var(--shadow-soft);
    font-size: 14px; display: flex; align-items: center; gap: 10px;
    animation: toast-in .25s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
.toast.info    { background: var(--info); }
.toast.warn    { background: var(--warning); color: #111; }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9999;
    display: none; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff; border-radius: var(--r-card); padding: 24px;
    width: 100%; max-width: 460px; box-shadow: var(--shadow-hover);
    animation: modal-in .25s ease;
}
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 980px; }
@keyframes modal-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal h3 { font-size: 18px; margin: 0 0 12px; }
.modal p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite;
    border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Empty state ---------- */
.empty {
    text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty i { font-size: 36px; margin-bottom: 12px; opacity: .5; }
.empty h4 { color: var(--text); margin: 0 0 6px; }
.empty p { font-size: 13px; margin: 0 0 16px; }

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed var(--border); border-radius: var(--r-input);
    padding: 24px; text-align: center; cursor: pointer;
    color: var(--muted); transition: .2s; background: #fafafa;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--teal); background: var(--teal-50); color: var(--teal); }
.dropzone i { font-size: 28px; margin-bottom: 8px; }
.dropzone .dz-hint { font-size: 12px; margin-top: 4px; }
.dropzone .dz-progress { margin-top: 10px; height: 6px; background: #eee; border-radius: 4px; overflow: hidden; }
.dropzone .dz-progress > span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .15s; }

/* ---------- Toggle ---------- */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track {
    width: 38px; height: 22px; background: var(--border); border-radius: 999px;
    position: relative; transition: .2s; flex-shrink: 0;
}
.toggle .track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .track { background: var(--teal); }
.toggle input:checked + .track::after { transform: translateX(16px); }

/* ---------- Utility ---------- */
.row { display: flex; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.hidden { display: none !important; }

@media (max-width: 720px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
