/* ============================================================
   TicktLive CRM — Sistema de diseño (basado en diseno.html)
   Estética estilo Apple: grises suaves, azul de acento, tarjetas.
   ============================================================ */
:root {
    --gray-1: #f5f5f7;
    --gray-2: #e5e5e7;
    --gray-3: #c5c5c8;
    --gray-4: #86868b;
    --gray-5: #424245;
    --gray-6: #1d1d1f;
    --gray-7: #121212;
    --accent-blue: #0071e3;
    --accent-green: #34c759;
    --accent-orange: #ff9500;
    --accent-red: #ff3b30;
    --accent-purple: #af52de;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: linear-gradient(270deg, #ffffff, #e4e4e4);
    color: var(--gray-6);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Header / Nav ---------- */
header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo img { height: 30px; }
.desktop-menu { display: flex; gap: 20px; align-items: center; }
.desktop-menu a {
    color: var(--gray-4);
    text-decoration: none;
    font-size: 12px;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 8px;
}
.desktop-menu a:hover, .desktop-menu a.active {
    background-color: var(--gray-1);
    color: var(--gray-6);
}
.desktop-menu a i { font-size: 16px; }
/* Botón salir: solo la flecha, pequeña y discreta, sin contorno ni fondo */
.logout-btn {
    -webkit-appearance: none !important; appearance: none !important;
    background: transparent !important; background-color: transparent !important;
    border: 0 !important; outline: 0 !important; box-shadow: none !important;
    cursor: pointer; color: var(--gray-4); font-size: 13px;
    padding: 4px 6px; margin: 0; line-height: 1; display: inline-flex; align-items: center;
    transition: color 0.2s;
}
.logout-btn:hover  { color: var(--accent-red); }
.logout-btn:focus,
.logout-btn:focus-visible,
.logout-btn:active { outline: 0 !important; box-shadow: none !important; border: 0 !important; }
.logout-btn form { display: inline; }
.mobile-menu-btn {
    display: none; background: none; border: none;
    color: var(--gray-4); font-size: 20px; cursor: pointer;
}
.mobile-menu {
    display: none; position: fixed; top: 70px; left: 0; width: 100%;
    background: linear-gradient(135deg, #ffffff, #eeeeee);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1); padding: 20px; z-index: 99;
}
.mobile-menu.active { display: block; }
.mobile-menu a, .mobile-menu button {
    display: flex; align-items: center; gap: 15px; padding: 12px 20px;
    color: var(--gray-4); text-decoration: none; border-radius: 8px;
    margin-bottom: 5px; font-size: 14px; width: 100%;
    background: none; border: none; cursor: pointer; text-align: left;
}
.mobile-menu a:hover { background-color: var(--gray-1); }

/* ---------- Main ---------- */
main {
    flex: 1; max-width: 1200px; width: 100%; margin: 30px auto; padding: 0 20px;
}
.welcome-section { text-align: left; margin: 0 25px 40px; }
.welcome-section h1 { font-size: 40px; margin-bottom: 10px; font-weight: 100; }
.welcome-section .subtitle { font-size: 16px; font-weight: 200; color: var(--gray-4); }

/* ---------- Dashboard cards ---------- */
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px; margin-bottom: 50px;
}
.dashboard-card {
    background: white; border-radius: 16px; padding: 30px; text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: all 0.3s ease;
    cursor: pointer; margin: 15px; text-decoration: none; color: inherit; display: block;
}
.dashboard-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.card-icon {
    width: 70px; height: 70px; margin: 0 auto 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 28px; color: white;
}
.card-icon.shipping { background: linear-gradient(135deg, var(--accent-blue), #0062b9); }
.card-icon.mail    { background: linear-gradient(135deg, var(--accent-green), #2daf4e); }
.card-icon.users   { background: linear-gradient(135deg, var(--accent-orange), #e68600); }
.card-icon.events  { background: linear-gradient(135deg, var(--accent-purple), #9b45d1); }
.card-icon.stats   { background: linear-gradient(135deg, #5ac8fa, #0071e3); }
.card-icon.logout  { background: linear-gradient(135deg, var(--accent-red), #e0352b); }
.dashboard-card h3 { font-size: 18px; margin-bottom: 10px; font-weight: 300; }
.dashboard-card p  { color: var(--gray-4); font-size: 14px; line-height: 1.5; font-weight: 200; }

/* KPI numbers */
.kpi-value { font-size: 34px; font-weight: 200; color: var(--gray-6); }

/* ---------- Forms ---------- */
.form-container {
    background-color: white; border-radius: 16px; padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); margin: 20px 0; width: 100%;
}
.form-group { margin-bottom: 25px; }
label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--gray-5); }
input[type="text"], input[type="email"], input[type="password"], input[type="file"],
input[type="datetime-local"], select, textarea {
    width: 100%; padding: 14px 16px; font-size: 16px; border: 1px solid var(--gray-3);
    border-radius: 12px; background-color: white; transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 16px center; background-size: 16px;
}
textarea { min-height: 200px; resize: vertical; }
.form-actions { margin-top: 30px; text-align: right; }
button[type="submit"] {
    padding: 11px 22px; font-size: 14px; font-weight: 500;
    background: linear-gradient(to bottom, var(--gray-5), var(--gray-7));
    color: white; border: none; border-radius: 10px; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.16); }
.field-error { color: var(--accent-red); font-size: 12px; margin-top: 6px; }
.hint { font-size: 12px; color: var(--gray-4); margin-top: 8px; }

/* ---------- Tables ---------- */
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.table-header h2 { font-size: 24px; color: var(--gray-6); margin: 0; font-weight: 200; }
.table-responsive { overflow-x: auto; }
.lists-table {
    width: 100%; border-collapse: collapse; background-color: white;
    border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.lists-table th, .lists-table td {
    padding: 16px; text-align: left; border-bottom: 1px solid var(--gray-2);
    font-weight: 300; font-size: 14px;
}
.lists-table th { background-color: var(--gray-1); color: var(--gray-5); }
.lists-table tr:hover { background-color: var(--gray-1); }
.actions { display: flex; gap: 10px; }
.action-btn {
    width: 26px; height: 26px; border-radius: 6px; display: flex;
    align-items: center; justify-content: center; color: white;
    text-decoration: none; transition: all 0.2s; font-size: 11px; border: none; cursor: pointer;
}
.action-btn.view   { background-color: var(--accent-blue); }
.action-btn.edit   { background-color: var(--accent-orange); }
.action-btn.delete { background-color: var(--accent-red); }
.action-btn:hover  { transform: translateY(-2px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.actions form { display: inline; }

/* ---------- Buttons (pill) — compactos y elegantes ---------- */
.buttonx {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; color: #fff !important; text-decoration: none;
    font-weight: 400; font-size: 12.5px; line-height: 1; border-radius: 10px;
    text-align: center; white-space: nowrap; border: none; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12); transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.buttonx:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.18); filter: brightness(1.05); }
.buttonx:active { transform: translateY(0); }
.buttonx i { font-size: 11px; }
.button-bluex   { background: linear-gradient(135deg, #2196F3, #1976D2); }
.button-greenx  { background: linear-gradient(135deg, #4CAF50, #2e7d32); }
.button-grayx   { background: linear-gradient(135deg, #9E9E9E, #6d6d6d); }
.button-blackx  { background: linear-gradient(135deg, #424242, #2b2b2b); }
.button-magentax{ background: linear-gradient(135deg, #d93f73, #a01a4c); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 400;
}
.badge-draft     { background: var(--gray-2); color: var(--gray-5); }
.badge-scheduled { background: #fff3e0; color: #e68600; }
.badge-sending   { background: #e3f2fd; color: #1976D2; }
.badge-sent      { background: #e8f5e9; color: #2daf4e; }
.badge-failed    { background: #ffebee; color: var(--accent-red); }

/* ---------- Progress bar (envío) ---------- */
.progress-wrap {
    background: var(--gray-2); border-radius: 999px; height: 16px;
    overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}
.progress-bar {
    height: 100%; width: 0%; border-radius: 999px;
    background: linear-gradient(90deg, #34c759, #0071e3);
    transition: width 0.4s ease;
}
.progress-meta {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    margin-top: 12px; font-size: 13px; color: var(--gray-5);
}
.progress-meta .chip {
    background: var(--gray-1); border-radius: 8px; padding: 6px 12px;
}
.progress-meta .chip b { font-weight: 500; }

/* ---------- Flash messages ---------- */
.flash { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; }
.flash-success { background: #e8f5e9; color: #1b5e20; }
.flash-error   { background: #ffebee; color: #b71c1c; }
.flash-info    { background: #e3f2fd; color: #0d47a1; }

/* ---------- Auth (login) ---------- */
.auth-wrapper { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    background: white; border-radius: 20px; padding: 40px; width: 100%; max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08); text-align: center;
}
.auth-card img { height: 34px; margin-bottom: 24px; }
.auth-card h1 { font-size: 24px; font-weight: 200; margin-bottom: 24px; }
.auth-card .form-group { text-align: left; }

/* ---------- Code editor ---------- */
.code-editor-container { position: relative; border: 1px solid var(--gray-3); border-radius: 12px; overflow: hidden; }
#codigo-html, .code-area {
    width: 100%; min-height: 340px; padding: 15px; font-family: 'Courier New', monospace;
    font-size: 14px; border: none; resize: vertical; background-color: var(--gray-1); color: var(--gray-6);
}

/* ---------- Stats grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.stat-card .label { font-size: 13px; color: var(--gray-4); margin-bottom: 8px; }
.stat-card .value { font-size: 30px; font-weight: 200; }
.stat-card .pct { font-size: 13px; color: var(--gray-4); }

/* ---------- Footer (igual al diseño) ---------- */
footer { background: linear-gradient(90deg, #0f1114, #3c3d3d); color: white; padding: 40px 0 20px; margin-top: 40px; }
.footer-container {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px;
}
.footer-logo { margin-bottom: 20px; }
.footer-logo img { height: 35px; }
.footer-info p { color: var(--gray-4); font-size: 12px; margin-bottom: 15px; font-weight: 300; line-height: 1.6; }
.footer-links h4 { font-size: 14px; margin-bottom: 20px; font-weight: 300; color: var(--gray-4); }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: var(--gray-4); text-decoration: none; font-size: 12px; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-bottom {
    text-align: center; padding-top: 30px; margin-top: 30px; border-top: 1px solid var(--gray-5);
}
.footer-bottom p { color: var(--gray-4); font-size: 12px; }
@media (max-width: 480px) { .footer-container { grid-template-columns: 1fr; gap: 20px; } }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .desktop-menu { display: none; }
    .mobile-menu-btn { display: block; }
    .welcome-section h1 { font-size: 32px; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 15px; }
    .dashboard-card { padding: 20px; margin: 8px; }
    .table-header { flex-direction: column; align-items: flex-start; gap: 15px; }
}
@media (max-width: 480px) { .dashboard-grid { grid-template-columns: 1fr; } }
