/**
 * Settings page — same design language as the Messages hub, Guests, Tasks and
 * Upsells. Tokens come from messaging-ui.css, which this page now loads.
 *
 * Deliberately CSS-led: Settings is ~2,300 lines of markup across three files
 * (settings.php, settings/team.php, settings/branding.php), all of it wired to
 * JS by id. Restyling the Bootstrap primitives in place covers all three
 * without touching those hooks.
 */

/* ==========================================================================
   PAGE LAYOUT
   ========================================================================== */
body.has-top-nav #main-content.p-4 {
    padding-top: calc(60px + 1.5rem) !important; /* 60px nav + 1.5rem (p-4) */
}

body {
    background-color: var(--hub-canvas);
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.settings-header {
    margin-bottom: 1.25rem;
}

.settings-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--hub-ink);
    margin: 0 0 0.1875rem;
}

.settings-subtitle {
    font-size: 0.8125rem;
    color: var(--hub-muted);
    margin: 0;
}

/* ==========================================================================
   TABS — the hub's underline bar on Bootstrap's tab markup
   ========================================================================== */
.settings-tabbar {
    margin-bottom: 1.5rem;
}

.settings-tabs {
    border-bottom: 1px solid var(--hub-border);
    gap: 1.625rem;
    margin: 0;
    flex-wrap: wrap;
}

.settings-tabs .nav-link {
    display: flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.8125rem 0.125rem;
    margin: 0 0 -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--hub-muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.settings-tabs .nav-link i {
    margin-right: 0 !important;
}

.settings-tabs .nav-link:hover {
    border-color: transparent;
    border-bottom-color: var(--hub-line);
    color: var(--hub-ink);
    background: transparent;
}

.settings-tabs .nav-link.active {
    background: transparent;
    border-color: transparent;
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* The shell is no longer a card — the panes carry their own cards */
.settings-shell {
    background: transparent;
}

.settings-body {
    padding: 0;
}

/* ==========================================================================
   SECTION HEADINGS
   ========================================================================== */
#main-content .tab-pane > h3,
#main-content .tab-pane > .d-flex > h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--hub-ink);
}

/* ==========================================================================
   CARDS — every card inside Settings, including team.php and branding.php
   ========================================================================== */
#main-content .card {
    background: #fff;
    border: 1px solid var(--hub-border);
    border-radius: 0.625rem;
    box-shadow: none;
}

#main-content .card-header {
    background: #fff;
    border-bottom: 1px solid var(--hub-border);
    padding: 0.875rem 1.125rem;
}

#main-content .card-header h5,
#main-content .card-header h6,
#main-content .card-header .card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--hub-ink);
    margin: 0;
}

#main-content .card-body {
    padding: 1.125rem;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
#main-content .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--hub-muted);
    margin-bottom: 0.3125rem;
}

#main-content .form-control,
#main-content .form-select {
    font-size: 0.84375rem;
    border-color: var(--hub-line);
    border-radius: var(--hub-radius);
    padding: 0.5625rem 0.75rem;
}

#main-content .form-select {
    padding-right: 2rem;
}

#main-content .form-control:focus,
#main-content .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--hub-tint);
}

#main-content .form-text {
    font-size: 0.71875rem;
    color: var(--hub-faint);
}

#main-content .form-check-label {
    font-size: 0.84375rem;
    color: var(--hub-ink);
}

#main-content .input-group-text {
    background: #f9fafb;
    border-color: var(--hub-line);
    color: var(--hub-muted);
    font-size: 0.84375rem;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
#main-content .btn {
    border-radius: 0.4375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4375rem 0.875rem;
}

#main-content .btn-sm {
    padding: 0.3125rem 0.6875rem;
    font-size: 0.78125rem;
}

#main-content .btn-outline-secondary,
#main-content .btn-outline-primary {
    border-color: var(--hub-line);
    color: var(--hub-muted);
}

#main-content .btn-outline-secondary:hover,
#main-content .btn-outline-primary:hover {
    background: #fff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================================================
   TABLES
   ========================================================================== */
#main-content .table > thead > tr > th {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hub-faint);
    background: #f9fafb;
    border-bottom: 1px solid var(--hub-border);
    padding: 0.625rem 1.125rem;
    white-space: nowrap;
}

#main-content .table > tbody > tr > td {
    padding: 0.75rem 1.125rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--hub-border-soft);
    font-size: 0.8125rem;
}

#main-content .table > tbody > tr:hover {
    background-color: var(--hub-row-active);
}

/* ==========================================================================
   BADGES — the shared pill shape
   ========================================================================== */
#main-content .badge {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.45;
    padding: 0.1875rem 0.625rem;
    border-radius: 99px;
}

/* ==========================================================================
   SYNC STATUS INDICATORS
   ========================================================================== */
/* Spinning animation for sync status */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   FAQ & KNOWLEDGE BASE
   ========================================================================== */
/* FAQ category badge styling */
.category-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */
/* Loading spinner overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
/* Smooth deletion animation */
.fade-out-delete {
    animation: fadeOutScale 0.3s ease-out forwards;
}

@keyframes fadeOutScale {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ==========================================================================
   GUEST JOURNEY TIMELINE
   ========================================================================== */
/* Journey Stage Cards */
.journey-stage-card {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.journey-stage-card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

/* Disabled stage styling */
.journey-stage-card.journey-stage-disabled {
    opacity: 0.6;
    background-color: var(--hub-canvas);
}

.journey-stage-card.journey-stage-disabled .card-header {
    background-color: #e9ecef !important;
}

.journey-stage-card.journey-stage-disabled .card-body {
    pointer-events: none;
}

/* Stage color coding */
.journey-stage-card[data-stage="pre_arrival"] {
    border-left-color: var(--primary-color);
}

.journey-stage-card[data-stage="arrival"] {
    border-left-color: #15803d;
}

.journey-stage-card[data-stage="in_house"] {
    border-left-color: #0e7490;
}

.journey-stage-card[data-stage="departure"] {
    border-left-color: #b45309;
}

.journey-stage-card[data-stage="post_departure"] {
    border-left-color: var(--hub-muted);
}

/* Journey toggle switches */
.journey-stage-toggle {
    cursor: pointer;
}

/* Preview button styling */
.journey-stage-card .btn-outline-primary {
    border-width: 1px;
    transition: all 0.2s ease;
}

.journey-stage-card .btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* AI Identity Section */
#ai-identity-section .card-header {
    border-bottom: 1px solid var(--hub-border);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .journey-stage-card .col-md-3 {
        margin-bottom: 1rem;
    }
}

/* Branding tab: drag-and-drop upload zones (moved from upsells.css with the Branding tab) */
.upload-zone {
    border: 2px dashed var(--hub-line);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: var(--hub-tint);
}

.upload-zone.dragover {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
/* Guest journey: upsell reminder sub-card inside Pre-Arrival */
.journey-reminder-card {
    border-left: 3px solid #0d6efd;
}
.journey-stage-card.journey-stage-disabled .journey-reminder-card:not(.journey-stage-disabled) {
    opacity: 1; /* keep the reminder legible while its parent is dimmed */
}

/* ==========================================================================
   NEUTRALISING BOOTSTRAP'S COLOUR UTILITIES
   The knowledge-base topic cards are built by structured-kb.js and carry
   bg-info / bg-warning headers; the Silent Hours cards carry border-warning
   and border-info. The colour coding is inconsistent (warning means "policy"
   on one card and "needs attention" on another), so it is not carrying
   meaning — the heading is. Neutralised here rather than in each generator.
   ========================================================================== */
#main-content .card.border-warning,
#main-content .card.border-info,
#main-content .card.border-primary,
#main-content .card.border-success,
#main-content .card.border-danger {
    border-color: var(--hub-border) !important;
}

#main-content .card-header[class*="bg-warning"],
#main-content .card-header[class*="bg-info"],
#main-content .card-header[class*="bg-light"],
#main-content .card-header[class*="bg-success"],
#main-content .card-header[class*="bg-primary"] {
    background-color: #fff !important;
}

/* ==========================================================================
   ALERTS — quiet panels rather than saturated blocks
   ========================================================================== */
#main-content .alert {
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    padding: 0.6875rem 0.875rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--hub-ink);
    background: var(--hub-fill);
}

#main-content .alert-success {
    background: #e3f5ea;
    border-color: #c6e6d3;
    color: #15803d;
}

#main-content .alert-warning {
    background: #fef3e2;
    border-color: #f5e0bd;
    color: #8a6100;
}

#main-content .alert-danger {
    background: #fdeaea;
    border-color: #f4cfcf;
    color: #b42318;
}

#main-content .alert-info,
#main-content .alert-primary {
    background: var(--hub-tint);
    border-color: #d3e3fd;
    color: #1b4fa8;
}

/* ==========================================================================
   ROLE PILLS — ascending access, the same idea as the upgrade tiers
   ========================================================================== */
.stage-pill.role-viewer {
    background: var(--hub-fill);
    color: var(--hub-muted);
}

.stage-pill.role-staff {
    background: #e7edf3;
    color: #4a5b6e;
}

.stage-pill.role-manager {
    background: var(--hub-tint);
    color: var(--primary-color);
}

.stage-pill.role-owner {
    background: #e8e6fd;
    color: #4f39c9;
}

/* ==========================================================================
   SECTION LABELS — the AI Configuration tab carries two distinct jobs now
   (how the assistant behaves, and what it knows), so each gets a heading and
   a rule between them rather than running together as one long column.
   ========================================================================== */
.settings-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hub-faint);
    margin-bottom: 0.75rem;
}

.settings-section-rule {
    border: 0;
    border-top: 1px solid var(--hub-border);
    opacity: 1;
    margin: 2rem 0 1.5rem;
}
