/* -------------------------------------------------------
   Villas Nizuc Messaging – Minimal stylesheet
   ------------------------------------------------------- */

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

:root {
    --color-bg:        #f8f8f6;
    --color-surface:   #ffffff;
    --color-border:    #d8d8d0;
    --color-text:      #1a1a1a;
    --color-muted:     #666;
    --color-primary:   #2c6e49;
    --color-primary-h: #245c3d;
    --color-danger:    #c0392b;
    --color-success:   #27ae60;
    --color-warn:      #e67e22;
    --radius:          6px;
    --font:            system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ---- Navigation ---- */
.navbar {
    background: var(--color-primary);
    color: #fff;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.navbar-brand { font-weight: 700; font-size: 1rem; margin-right: 1rem; }
.navbar a { color: rgba(255,255,255,0.88); text-decoration: none; font-size: 0.9rem; }
.navbar a:hover { color: #fff; }
.navbar .nav-right { margin-left: auto; }

/* ---- Layout ---- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ---- Typography ---- */
h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { background: var(--color-primary-h); }
.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg); }
.btn-sm { padding: .25rem .65rem; font-size: .82rem; }
.btn-danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover { background: #a93226; }
.btn-full { width: 100%; text-align: center; padding: 0.75rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; }
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=search], select, textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    background: var(--color-surface);
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}
textarea { resize: vertical; }
.checkboxes label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkboxes input[type=checkbox] { width: auto; }
.required { color: var(--color-danger); }
.hint { font-size: 0.8rem; color: var(--color-muted); margin-top: 0.4rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.875rem; }
th { text-align: left; padding: 0.5rem 0.75rem; background: var(--color-bg);
     border-bottom: 2px solid var(--color-border); font-size: 0.8rem; text-transform: uppercase;
     letter-spacing: 0.04em; color: var(--color-muted); white-space: nowrap; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.nowrap { white-space: nowrap; }
.row-cancelled td { text-decoration: line-through; color: var(--color-muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f2f4f1; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-email   { background: #dbeafe; color: #1d4ed8; }
.badge-sms     { background: #fef9c3; color: #854d0e; }
.badge-draft   { background: #f3f4f6; color: #374151; }
.badge-sending { background: #fef3c7; color: #92400e; }
.badge-sent    { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- Stat cards ---- */
.stat-grid { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0; }
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    min-width: 140px;
    flex: 1;
}
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: 0.8rem; color: var(--color-muted); margin-top: 0.25rem; }

/* ---- Section header ---- */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-header h1, .section-header h2 { margin-bottom: 0; }
.sep { color: var(--color-muted); margin: 0 0.25rem; }

/* ---- Search bar ---- */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.search-bar input { flex: 1; max-width: 380px; }

/* ---- Messages ---- */
.error       { background: #fee2e2; color: #991b1b; padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.success     { color: var(--color-success); }
.success-box { background: #dcfce7; color: #166534; padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; }
.empty       { color: var(--color-muted); font-style: italic; padding: 2rem 0; text-align: center; }
.meta        { font-size: 0.85rem; color: var(--color-muted); margin-bottom: 0.5rem; }
.text-success { color: var(--color-success); }
.text-error   { color: var(--color-danger); }

/* ---- Campaign preview ---- */
.campaign-meta { display: flex; gap: 1.5rem; font-size: 0.875rem; color: var(--color-muted); margin-bottom: 1.25rem; flex-wrap: wrap; }
.message-preview {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.message-preview pre { white-space: pre-wrap; font-family: var(--font); font-size: 0.9rem; line-height: 1.7; }

/* ---- Placeholder bar ---- */
.placeholder-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; align-items: center; font-size: 0.8rem; color: var(--color-muted); }
.placeholder-bar button {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: monospace;
}
.placeholder-bar button:hover { background: #e8ede9; }

/* ---- Public / opt-in page ---- */
.public-page { min-height: calc(100vh - 52px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.public-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 2.5rem; width: 100%; max-width: 440px; }
.public-card h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.tagline { color: var(--color-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }

/* ---- Auth page ---- */
.auth-box { max-width: 380px; margin: 6rem auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 2.5rem; }
.auth-box h1 { margin-bottom: 1.5rem; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .stat-card { min-width: 100px; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
