/* ==========================================================================
   AQUÍ — URL Shortener & Analytics System (Design System Premium)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --ok: #10b981;
    --radius: 16px;
    --shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 20px 35px -5px rgba(99, 102, 241, 0.15);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

h1, h2, h3, .brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

/* Botones con Estética Pro */
button, .button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: #ffffff !important;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

button:hover, .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

button.secondary, .button.secondary {
    background: #64748b;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

button.secondary:hover {
    background: #475569;
    box-shadow: 0 6px 16px rgba(100, 116, 139, 0.3);
}

button.danger, .button.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

button.danger:hover {
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

/* Layout & Contenedores */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
}

.container-sm {
    max-width: 440px;
    margin: 80px auto;
    padding: 36px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Topbar Header */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.topbar h1 {
    font-size: 32px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-top: -4px;
}

.subnav {
    font-size: 13px;
    margin-top: 8px;
    font-weight: 600;
}

.subnav a {
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 6px;
    background: #f1f5f9;
}

.subnav a:hover {
    color: var(--primary);
    background: #e2e8f0;
}

/* Cards & Formularios */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    color: #0f172a;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: #f8fafc;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

small {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    align-items: end;
}

/* Tablas Modernas */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
}

th {
    background: #0f172a;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    padding: 14px 16px;
}

td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fafc;
}

.truncate {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.actions a, .actions button, .actions summary {
    font-size: 12px;
    padding: 6px 12px;
}

.actions summary {
    cursor: pointer;
    background: #475569;
    color: #ffffff;
    border-radius: 6px;
    list-style: none;
    font-weight: 700;
}

.edit-form {
    min-width: 280px;
    background: #f8fafc;
    padding: 16px;
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.check {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mensajes de Alerta */
.msg-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid #fecaca;
    margin-bottom: 20px;
    font-size: 14px;
}

.msg-ok {
    background: #ecfdf5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid #a7f3d0;
    margin-bottom: 20px;
    font-size: 14px;
}

.center {
    text-align: center;
}

/* Intersticial Futurist Page (r.php) */
.interstitial {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top, #1e1b4b 0%, #0f172a 100%);
    color: #ffffff;
}

.interstitial-card {
    width: min(680px, 100%);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #0f172a;
}

.brand {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.1em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.progress {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 24px 0;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--primary-gradient);
    transition: width 1s linear;
    border-radius: 999px;
}

.sponsor-box {
    margin: 28px auto;
    padding: 24px;
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: 16px;
    max-width: 540px;
}

.sponsor-box span {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    display: block;
    margin-bottom: 8px;
}

@media (max-width: 800px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .container {
        padding: 20px 14px;
    }
    .interstitial-card {
        padding: 28px 20px;
    }
}
