﻿/* ============================================================
   TextBot Automations — Site Styles
   Color palette mirrors the teal/navy UI in the wireframe
   ============================================================ */

:root {
    --navy: #0f2942;
    --teal: #1a5276;
    --teal-mid: #1f6181;
    --teal-light: #2e86ab;
    --accent: #22a2c9;
    --accent-hover: #1a8faf;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --border: #d1dce8;
    --text: #1a2a3a;
    --text-secondary: #5a7a94;
    --success: #1a9c6e;
    --danger: #c0392b;
    --warning: #e67e22;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 12px rgba(15,41,66,0.08);
    --shadow-md: 0 4px 24px rgba(15,41,66,0.13);
    --font: 'DM Sans', sans-serif;
    --mono: 'DM Mono', monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 56px;
    background: var(--navy);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.2rem;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    letter-spacing: 0.02em;
}

.navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.nav-link {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s;
}

    .nav-link:hover {
        color: #fff;
        background: rgba(255,255,255,0.08);
    }

    .nav-link.active {
        color: #fff;
        background: rgba(255,255,255,0.15);
    }

.navbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}

.btn-logout {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

    .btn-logout:hover {
        background: rgba(255,255,255,0.2);
        color: #fff;
    }

/* ── Main Content ────────────────────────────────────── */
.main-content {
    padding: 2rem;
}

    .main-content.has-nav {
        padding-top: calc(56px + 2rem);
    }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    font-weight: 500;
}

.alert-success {
    background: #d1f2e5;
    color: #0a5c3a;
    border: 1px solid #a8e4c6;
}

.alert-error {
    background: #fdecea;
    color: #8b1a10;
    border: 1px solid #f5b7b1;
}

.alert-icon {
    font-weight: 700;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--teal-light);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--accent-hover);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(34,162,201,0.3);
    }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
}

    .btn-secondary:hover {
        border-color: var(--teal-light);
        color: var(--teal-light);
    }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

    .btn-danger:hover {
        background: #a93226;
    }

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ── Page Header ─────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    transition: color 0.15s;
}

    .back-link:hover {
        color: var(--teal-light);
    }

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ── Table Card ──────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

    .data-table thead tr {
        background: var(--navy);
        color: rgba(255,255,255,0.9);
    }

    .data-table th {
        padding: 0.85rem 1rem;
        text-align: left;
        font-weight: 600;
        font-size: 0.8rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .data-table tbody tr {
        border-bottom: 1px solid var(--border);
        transition: background 0.12s;
    }

        .data-table tbody tr:last-child {
            border-bottom: none;
        }

        .data-table tbody tr:hover {
            background: #f5f9fd;
        }

    .data-table td {
        padding: 0.85rem 1rem;
        vertical-align: middle;
    }

.col-actions {
    width: 120px;
}

.cell-primary {
    font-weight: 600;
    color: var(--text);
}

.cell-secondary {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

/* ── Toggle Button (Active/Inactive) ─────────────────── */
.toggle-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
}

    .toggle-btn.active {
        background: #d1f2e5;
        color: #0a5c3a;
    }

    .toggle-btn.inactive {
        background: #fdecea;
        color: #8b1a10;
    }

    .toggle-btn:hover {
        filter: brightness(0.92);
    }

/* ── Action Buttons ──────────────────────────────────── */
.action-group {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.12s;
}

    .action-btn:hover {
        background: var(--bg);
        border-color: var(--teal-light);
    }

    .action-btn.danger:hover {
        background: #fdecea;
        border-color: var(--danger);
    }

/* ── Badge / Labels ──────────────────────────────────── */
.lang-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--mono);
}

    .lang-badge.both {
        background: #e8f4fd;
        color: #1a5276;
    }

    .lang-badge.en {
        background: #d6eaf8;
        color: #1a5276;
    }

    .lang-badge.es {
        background: #fef9e7;
        color: #7d6608;
    }

.status-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

    .status-badge.active {
        background: #d1f2e5;
        color: #0a5c3a;
    }

    .status-badge.inactive {
        background: #fdecea;
        color: #8b1a10;
    }

.mono {
    font-family: var(--mono);
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-secondary);
}

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    font-size: 1.3rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ── Login ───────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-mid) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 0.25rem;
}

.login-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 1.25rem;
    font-family: var(--mono);
}

/* ── Form Elements ───────────────────────────────────── */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.form-section {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border);
}

    .form-section:last-child {
        border-bottom: none;
    }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
    margin-top: -0.5rem;
}

.form-grid {
    display: grid;
    gap: 1.25rem;
}

.two-col {
    grid-template-columns: 1fr 1fr;
}

.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 700px) {
    .two-col, .three-col {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.required {
    color: var(--danger);
}

.form-input, .form-select, .form-textarea {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

    .form-input:focus, .form-select:focus, .form-textarea:focus {
        border-color: var(--teal-light);
        box-shadow: 0 0 0 3px rgba(46,134,171,0.12);
    }

.form-textarea {
    resize: vertical;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.field-error {
    color: var(--danger);
    font-size: 0.8rem;
}

.validation-summary {
    background: #fdecea;
    color: #8b1a10;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.87rem;
}

    .validation-summary ul {
        margin: 0;
        padding-left: 1.25rem;
    }

/* ── Clinic Grid ─────────────────────────────────────── */
.clinic-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.clinic-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    background: var(--surface);
}

    .clinic-option:hover {
        border-color: var(--teal-light);
    }

    .clinic-option.selected {
        border-color: var(--teal-light);
        background: #e8f4fd;
    }

.clinic-check {
    display: none;
}

.clinic-name {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ── Language Tabs ───────────────────────────────────── */
.lang-tabs {
    display: flex;
    gap: 0.5rem;
}

.lang-tab {
    padding: 0.4rem 1rem;
    border-radius: 6px 6px 0 0;
    border: 1.5px solid var(--border);
    border-bottom: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

    .lang-tab.active {
        background: var(--surface);
        color: var(--teal-light);
        border-color: var(--teal-light);
    }

/* ── Toggle Switch ───────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-top: 0.4rem;
}

.toggle-checkbox {
    display: none;
}

.toggle-switch {
    width: 42px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

    .toggle-switch::after {
        content: '';
        position: absolute;
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        transition: left 0.2s;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }

.toggle-checkbox:checked ~ .toggle-switch {
    background: var(--teal-light);
}

    .toggle-checkbox:checked ~ .toggle-switch::after {
        left: 21px;
    }

.toggle-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ── Form Actions ────────────────────────────────────── */
.form-actions {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Details ─────────────────────────────────────────── */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.message-card {
    grid-column: 1 / -1;
}

.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.detail-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem 1.5rem;
}

    .detail-list dt {
        color: var(--text-secondary);
        font-size: 0.82rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        align-self: center;
    }

    .detail-list dd {
        font-size: 0.9rem;
        color: var(--text);
    }

.message-body {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: 1fr;
    }

    .message-card {
        grid-column: 1;
    }

    .page-header {
        flex-direction: column;
    }

    .data-table {
        font-size: 0.8rem;
    }
}

/* ── Error Page ──────────────────────────────────────── */
.error-page {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.error-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 3rem 2.5rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.error-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

.error-id {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.error-id-label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.error-id code {
    font-family: var(--mono);
    color: var(--text);
}

/* ── Self badge (Users table) ────────────────────────── */
.self-badge {
    display: inline-block;
    background: #e8f4fd;
    color: var(--teal-light);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    vertical-align: middle;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ── Change Password Link ────────────────────────────── */
.change-pw-link {
    color: var(--teal-light);
    font-size: 0.82rem;
    text-decoration: none;
}

    .change-pw-link:hover {
        text-decoration: underline;
    }


.bg-info {
    background-color: #1f6b82 !important;
}

.bg-primary {
    background-color: #1f6b82 !important;
}

textarea {
    min-height: 80px;
}



