/* Additional variables for playbook-specific styling */
:root {
    --green: #27ae60;
    --green-light: #d5f4e6;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

/* Body overrides - shared/styles.css handles gutters/max-width */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    padding: 24px;
    /* Security: Hide body until auth completes to prevent flash of content */
    display: none;
}

/* ==================== STICKY HEADER WRAPPER ==================== */
.sticky-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding-top: 16px;
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.logo-section img {
    height: 32px;
    width: auto;
}

/* Document title bar (in sticky header) */
.document-title-bar {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--gray-200);
}

.document-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.document-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
    align-items: center;
}

.document-meta .divider {
    color: var(--gray-300);
}

.badge {
    background: var(--transcend-light);
    color: var(--transcend-blue);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* Back link */
.playbook-back-link {
    display: inline-block;
    color: var(--transcend-blue);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.playbook-back-link:hover {
    color: #1e4278;
    text-decoration: underline;
}

/* Auth UI classes from /shared/styles.css */
/* Only playbook-specific overrides below */
#loadingState,
#authRequired,
#accessDenied {
    border-radius: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--transcend-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#accessDenied {
    background: var(--red-light);
    border: 1px solid var(--red);
}

#accessDenied h2 {
    color: var(--red);
}

.hidden {
    display: none !important;
}

.auth-copy { margin: 20px 0; }
.auth-copy-muted { color: var(--gray-500); }
.title-bar-spaced { margin-bottom: 12px; }
.document-audience {
    margin-top: 12px;
    color: var(--gray-500);
    font-size: 14px;
    line-height: 1.5;
}
.section-intro {
    color: var(--gray-600);
    margin-bottom: 16px;
}
.section-intro-tight {
    color: var(--gray-600);
    margin-bottom: 12px;
}
.is-clickable { cursor: pointer; }
.text-danger { color: var(--red); }
.table-row-danger { background: var(--red-light); }
.is-hidden-marker { display: none; }
.table-spaced,
.alert-spaced,
.subhead-spaced { margin-top: 24px; }
.metric-value-small {
    font-size: 16px;
    line-height: 1.35;
}
.raci-note {
    color: var(--gray-500);
    font-size: 13px;
    margin-top: 12px;
}
.footer-note { margin-top: 8px; }
.comments-empty-help {
    font-size: 12px;
    margin-top: 8px;
}

.page-contract,
.source-freshness {
    margin: 0 0 18px;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
}

.page-contract {
    border-left: 4px solid #1e3a8a;
}

.page-contract h2 {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-size: 1.15rem;
}

.page-contract p,
.source-freshness p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.access-summary {
    margin: 0 0 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.access-summary > div {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    padding: 14px;
}

.access-label,
.source-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.access-summary span:last-child {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.source-freshness {
    border-left: 4px solid #0f766e;
    background: #f0fdfa;
}

/* Navigation */
.nav {
    background: var(--gray-100);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 0;
}

.nav-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-item {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--transcend-blue);
    color: white;
    border-color: var(--transcend-blue);
}

/* Section Styles */
.section {
    background: white;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    scroll-margin-top: 270px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}

.section-number {
    background: var(--transcend-blue);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

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

h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 28px 0 16px;
}

/* Core Premise Box */
.premise-box {
    background: var(--gray-900);
    color: white;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.premise-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.premise-statement {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.premise-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.premise-column h4 {
    font-size: 14px;
    color: var(--green);
    margin-bottom: 12px;
}

.premise-column.dont h4 {
    color: var(--red);
}

.premise-column ul {
    list-style: none;
    font-size: 14px;
    color: var(--gray-300);
}

.premise-column li {
    padding: 6px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Decision Flow */
.decision-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
    background: var(--gray-50);
    border-radius: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.flow-step {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px 24px;
    text-align: center;
    min-width: 180px;
}

.flow-step.active {
    border-color: var(--transcend-blue);
    background: var(--transcend-light);
}

.flow-step-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.flow-step-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.flow-arrow {
    font-size: 24px;
    color: var(--gray-300);
}

/* Alert Boxes */
.alert {
    padding: 16px 20px;
    border-radius: 10px;
    margin: 16px 0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-text {
    font-size: 14px;
}

.alert-info {
    background: var(--transcend-light);
    border: 1px solid var(--transcend-blue);
}
.alert-info .alert-title { color: var(--transcend-blue); }

.alert-warning {
    background: var(--amber-light);
    border: 1px solid var(--amber);
}
.alert-warning .alert-title { color: #92400e; }

.alert-danger {
    background: var(--red-light);
    border: 1px solid var(--red);
}
.alert-danger .alert-title { color: var(--red); }

.alert-success {
    background: var(--green-light);
    border: 1px solid var(--green);
}
.alert-success .alert-title { color: var(--green); }

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

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

th {
    background: var(--transcend-blue);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-bottom: 2px solid var(--transcend-blue);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

tr:hover td {
    background: var(--gray-50);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-green {
    background: var(--green-light);
    color: var(--green);
}

.status-amber {
    background: var(--amber-light);
    color: #92400e;
}

.status-red {
    background: var(--red-light);
    color: var(--red);
}

.status-blue {
    background: var(--transcend-light);
    color: var(--transcend-blue);
}

/* LTV Shape Cards */
.ltv-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 24px 0;
}

.ltv-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
}

.ltv-card.current {
    border-color: var(--transcend-blue);
    background: var(--transcend-light);
}

.ltv-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.ltv-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.ltv-card-desc {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 16px;
}

.ltv-card-channels {
    font-size: 13px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.ltv-card-channels strong {
    color: var(--gray-900);
}

/* Channel Cards */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.channel-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
}

.channel-card.primary {
    border-color: var(--green);
}

.channel-card.test {
    border-color: var(--amber);
}

.channel-card.locked {
    border-color: var(--red);
    opacity: 0.7;
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.channel-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.channel-detail {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.channel-detail strong {
    color: var(--gray-900);
}

/* Checklist */
.checklist {
    list-style: none;
    background: var(--gray-50);
    border-radius: 12px;
    padding: 8px;
}

.checklist-group-label {
    padding: 12px 12px 4px;
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}

.checklist-item:last-child {
    margin-bottom: 0;
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: transparent;
}

.checklist-content {
    flex: 1;
}

.checklist-label {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.checklist-description {
    font-size: 13px;
    color: var(--gray-500);
}

/* Creative Hook Table */
.hook-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.hook-card {
    background: var(--gray-50);
    border-radius: 10px;
    padding: 20px;
}

.hook-type {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.hook-example {
    font-size: 14px;
    color: var(--transcend-blue);
    font-style: italic;
    margin-bottom: 8px;
}

.hook-why {
    font-size: 13px;
    color: var(--gray-500);
}

/* Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.metric-card {
    background: var(--gray-50);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.metric-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.metric-desc {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Footer */
.playbook-footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-size: 0.85rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 40px;
}

/* Interactive Checkboxes */
.checkbox-input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    cursor: pointer;
    accent-color: var(--transcend-blue);
    flex-shrink: 0;
}

.checklist-content {
    cursor: pointer;
    flex: 1;
}

.checkbox-input:checked + .checklist-content .checklist-label {
    text-decoration: line-through;
    color: var(--gray-400);
}

/* LTV Card Selection */
.ltv-card {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.ltv-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ltv-card.current {
    border-color: var(--transcend-blue);
    background: var(--transcend-light);
}

.ltv-current-marker {
    font-size: 12px;
    color: var(--transcend-blue);
    font-weight: 600;
}

.ltv-row-active {
    background: var(--transcend-light) !important;
}

/* Channel Grid Dynamic */
.channel-grid-container {
    position: relative;
}

.channel-grid-state {
    display: none;
}

.channel-grid-state.active {
    display: grid;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 16px; }
    .sticky-header-wrapper {
        position: relative;
        margin: 0 -16px 20px;
        padding: 12px 16px 8px;
    }
    .document-title-bar { padding: 14px; }
    .document-title { font-size: 1.2rem; }
    .document-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    .nav-item {
        padding: 8px 10px;
        font-size: 12px;
    }
    .access-summary { grid-template-columns: 1fr; }
    .page-contract { padding-right: 56px; }
    #commentsToggle.comments-toggle {
        width: 44px;
        height: 44px;
        right: 12px;
        bottom: 12px;
        font-size: 18px;
    }
    .premise-grid { grid-template-columns: 1fr; }
    .ltv-grid { grid-template-columns: 1fr; }
    .decision-flow { flex-direction: column; }
    .flow-arrow { transform: rotate(90deg); }
    .flow-step { width: 100%; }
    .metrics-row { grid-template-columns: 1fr; }
    .hook-grid { grid-template-columns: 1fr; }
}

@media print {
    .nav { display: none; }
    .section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-200);
        margin-bottom: 24px;
    }
    .premise-box {
        background: var(--gray-100) !important;
        color: var(--gray-900) !important;
    }
    .premise-box .premise-title,
    .premise-box .premise-statement {
        color: var(--gray-900) !important;
    }
    .premise-column ul { color: var(--gray-700) !important; }
    .premise-column h4 { color: var(--green) !important; }
    .premise-column.dont h4 { color: var(--red) !important; }
    body { font-size: 11px; }
    .section { padding: 20px; }
    .playbook-footer {
        border-top: 1px solid var(--gray-300);
        page-break-inside: avoid;
    }
    .alert { page-break-inside: avoid; }
    table { font-size: 10px; }
    th, td { padding: 8px 10px; }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Active nav state */
.nav-item.active {
    background: var(--transcend-blue);
    color: white;
    border-color: var(--transcend-blue);
}
