/* Gestor de Propuestas — admin styles */

:root {
    --bg: #f6f7fb;
    --bg-card: #ffffff;
    --border: #e6e8ef;
    --border-strong: #d2d6e0;
    --text: #1f2330;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #059669;
    --warning: #d97706;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-muted); }

/* ===== Top bar ===== */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
}
.brand {
    margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em;
}
.topnav { display: flex; align-items: center; gap: 14px; }

/* ===== Stat cards ===== */
.stats-row {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin: 28px 0 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

/* ===== Actions row ===== */
.actions-row {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin: 16px 0;
}
.actions-left { display: flex; gap: 8px; }

.search-input {
    width: 280px; padding: 8px 12px; font: inherit;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: #fff;
}
.search-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

/* ===== Folder chips ===== */
.folder-chips {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px;
}
.chip {
    display: inline-block;
    padding: 4px 10px; font-size: 12px;
    border: 1px solid var(--border-strong); border-radius: 99px;
    background: #fff; color: var(--text); text-decoration: none;
    transition: all .12s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-active:hover { color: #fff; }
.chip-mini { font-size: 11px; padding: 2px 8px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 8px 14px; font: inherit; font-weight: 500;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: #fff; color: var(--text);
    cursor: pointer; transition: all .12s; text-decoration: none;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Icon buttons (small actions in table) */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
    color: var(--text); text-decoration: none;
    transition: all .12s;
}
.icon-btn:hover { background: var(--bg); border-color: var(--border-strong); }
.icon-btn-danger:hover { background: #fee2e2; border-color: var(--danger); }

/* ===== Table ===== */
.table-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table {
    width: 100%; border-collapse: collapse;
}
.table thead th {
    background: #fafbfc;
    text-align: left; padding: 10px 16px;
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions-col { white-space: nowrap; text-align: right; }
.cell-title strong { display: block; font-weight: 600; }
.slug { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

.empty-state {
    padding: 60px 24px; text-align: center;
}
.empty-state p { color: var(--text-muted); margin: 0 0 16px; }

/* ===== Forms ===== */
form label {
    display: block; margin-bottom: 14px;
}
form label > span {
    display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500;
}
form input[type=text], form input[type=password], form input[type=search],
form input[type=email], form select, form textarea {
    width: 100%; padding: 8px 12px; font: inherit;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: #fff;
}
form input:focus, form select:focus, form textarea:focus {
    outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent;
}
.slug-input {
    display: flex; align-items: center;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    overflow: hidden; background: #fff;
}
.slug-input:focus-within { outline: 2px solid var(--primary); outline-offset: -1px; }
.slug-prefix {
    padding: 8px 10px; background: #f3f4f7; color: var(--text-muted);
    font-size: 12px; font-family: ui-monospace, monospace; border-right: 1px solid var(--border);
}
.slug-input input { border: 0 !important; outline: 0 !important; }

/* Dropzone */
.dropzone {
    position: relative;
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
    padding: 28px 16px; text-align: center; transition: all .12s;
    background: #fafbfc;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary); background: #eef2ff;
}
.dropzone input[type=file] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.dz-text { margin: 0; }
.dz-file { margin: 6px 0 0; font-size: 12px; }

.alert {
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
    font-size: 13px;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* ===== Login ===== */
.login-body {
    min-height: 100vh; display: grid; place-items: center; background: var(--bg);
}
.login-card {
    background: #fff; padding: 32px;
    border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    width: 100%; max-width: 380px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .subtitle { margin: 0 0 24px; color: var(--text-muted); font-size: 13px; }

/* ===== Modal ===== */
.modal[hidden] { display: none; }
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(2px);
}
.modal-card {
    position: relative;
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    max-height: calc(100vh - 40px); overflow: auto;
    padding: 24px;
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 760px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px;
}

/* ===== Stats modal content ===== */
.stats-summary {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    margin-bottom: 18px;
}
.stat-mini {
    padding: 10px 12px;
    background: var(--bg); border-radius: var(--radius-sm);
}
.stat-mini-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .05em; }
.stat-mini-value { font-size: 20px; font-weight: 700; margin-top: 2px; }

.stats-url {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--bg);
    border-radius: var(--radius-sm); margin-bottom: 18px;
    font-family: ui-monospace, monospace; font-size: 12px;
    word-break: break-all;
}
.stats-url a { color: var(--primary); text-decoration: none; }

.visits-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.visits-table th, .visits-table td {
    padding: 8px 10px; text-align: left;
    border-bottom: 1px solid var(--border);
}
.visits-table th { background: #fafbfc; font-size: 11px; text-transform: uppercase; color: var(--text-muted); }

.country-breakdown {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px;
}
.country-pill {
    padding: 4px 10px; background: var(--bg); border-radius: 99px;
    font-size: 12px;
}

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff;
    padding: 10px 18px; border-radius: var(--radius-sm);
    font-size: 13px; box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: toast-in .25s ease;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
@keyframes toast-in {
    from { transform: translate(-50%, 12px); opacity: 0; }
    to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .container { padding: 0 14px; }
    .search-input { width: 100%; }
    .actions-row { flex-direction: column; align-items: stretch; }
    .search-form { width: 100%; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr {
        border-bottom: 1px solid var(--border); padding: 10px 4px;
    }
    .table td { padding: 4px 12px; border: 0; }
    .table .actions-col { text-align: left; padding-top: 8px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}
