/* 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 */
body {
    padding: 24px;
    /* Security: Hide body until auth completes to prevent flash of content */
    display: none;
}

/* ==================== HEADER ==================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

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

/* Document title bar */
.document-title-bar {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.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;
}

.page-contract,
.access-summary,
.source-freshness {
    margin-bottom: 24px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.05);
}

.page-contract {
    padding: 18px 20px;
    border-left: 4px solid var(--green);
}

.page-contract h2,
.section-heading {
    margin: 0 0 8px 0;
    color: var(--gray-900);
    font-size: 18px;
}

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

.access-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
}

.access-summary .section-heading {
    grid-column: 1 / -1;
    padding: 14px 16px;
    margin: 0;
    border-bottom: 1px solid var(--gray-200);
}

.access-summary > div {
    padding: 14px 16px;
    border-right: 1px solid var(--gray-200);
}

.access-summary > div:last-child {
    border-right: 0;
}

.access-label,
.source-label {
    display: block;
    margin-bottom: 6px;
    color: var(--transcend-blue);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.source-freshness {
    padding: 14px 16px;
    border-left: 4px solid var(--amber);
}

.source-freshness .section-heading {
    margin-bottom: 8px;
}

.strategy-copy {
    margin: 24px 0;
    font-size: 1.05rem;
    line-height: 1.7;
}

.danger-text {
    color: var(--red);
}

.note-small {
    margin-top: 8px;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.flag-green td {
    background: var(--green-light);
}

.flag-yellow td {
    background: var(--amber-light);
}

.flag-orange td {
    background: #fed7aa;
}

.flag-red td {
    background: var(--red-light);
}

.version-note {
    margin-top: 32px;
}

.version-list {
    margin-top: 8px;
    padding-left: 20px;
}

.version-details {
    margin-top: 12px;
}

.version-summary {
    cursor: pointer;
    color: var(--transcend-blue);
}

.footer-copy {
    margin-top: 8px;
}

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

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

/* ==================== AUTH STATES ==================== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-900);
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--transcend-blue);
    color: white;
}

.btn-primary:hover {
    background: #1e4278;
}

.btn-secondary {
    background: white;
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.loading-state, .auth-required, .access-denied {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    margin-bottom: 20px;
}

.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); }
}

.access-denied {
    background: var(--red-light);
    border: 1px solid var(--red);
}

.access-denied h2 {
    color: var(--red);
}

.hidden {
    display: none !important;
}

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

.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: 200px;
}

.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;
    flex-shrink: 0;
}

.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;
}

h3:first-child {
    margin-top: 0;
}

h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 20px 0 12px;
}

/* 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: 20px;
    font-weight: 600;
    line-height: 1.5;
}

/* 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);
}

/* Game Type Cards */
.game-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 24px 0;
}

@media (max-width: 900px) {
    .game-type-grid {
        grid-template-columns: 1fr;
    }

    .access-summary {
        grid-template-columns: 1fr;
    }

    .access-summary > div {
        border-right: 0;
        border-bottom: 1px solid var(--gray-200);
    }

    .access-summary > div:last-child {
        border-bottom: 0;
    }
}

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

.game-type-card h4 {
    color: var(--transcend-blue);
    margin: 0 0 12px 0;
}

.game-type-card p {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.game-type-card .examples {
    font-size: 13px;
    color: var(--gray-500);
    font-style: italic;
    margin-bottom: 12px;
}

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

.game-type-card .metrics strong {
    color: var(--gray-900);
}

/* Pattern Cards */
.pattern {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--gray-200);
}

.pattern:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.pattern-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.pattern-number {
    background: var(--transcend-light);
    color: var(--transcend-blue);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.pattern-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.mechanism-box {
    background: var(--gray-50);
    border-left: 4px solid var(--transcend-blue);
    padding: 16px 20px;
    margin: 16px 0;
    font-size: 14px;
    color: var(--gray-700);
    border-radius: 0 8px 8px 0;
}

.rules-list {
    margin-top: 16px;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--gray-700);
}

.rule-item::before {
    content: '→';
    color: var(--transcend-blue);
    font-weight: 600;
    flex-shrink: 0;
}

/* Option Cards */
.option-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.option-header {
    padding: 20px 24px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.option-letter {
    display: inline-block;
    background: var(--transcend-blue);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    font-weight: 700;
    margin-right: 12px;
}

.option-title {
    font-size: 18px;
    font-weight: 600;
    display: inline;
}

.option-best-for {
    margin-top: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.option-best-for strong {
    color: var(--green);
}

.option-body {
    padding: 24px;
}

.sequence-list {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.sequence-list h5 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.sequence-steps {
    counter-reset: step;
}

.sequence-step {
    counter-increment: step;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--gray-700);
}

.sequence-step::before {
    content: counter(step);
    background: var(--transcend-blue);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Failure modes */
.failure-list {
    margin-top: 16px;
}

.failure-item {
    background: var(--red-light);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--gray-700);
    border-left: 3px solid var(--red);
    margin-bottom: 8px;
}

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

/* Trigger grid */
.trigger-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .trigger-grid {
        grid-template-columns: 1fr;
    }
}

.trigger-condition {
    background: var(--amber-light);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 3px solid var(--amber);
}

.trigger-response {
    background: var(--green-light);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 3px solid var(--green);
}

/* Checklists */
.checklist {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
}

.checklist h4 {
    margin: 0 0 16px 0;
}

.checklist-items {
    display: grid;
    gap: 10px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.checklist-item:has(input:checked) {
    background: var(--green-light);
    border-color: var(--green);
}

.checkbox-input {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--gray-300);
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.checkbox-input:checked {
    background: var(--green);
    border-color: var(--green);
}

.checkbox-input:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.4;
}

/* Localization tiers */
.tier-list {
    margin: 20px 0;
}

.tier-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 12px;
}

.tier-badge {
    background: var(--transcend-blue);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.tier-badge.tier-2 {
    background: var(--gray-500);
}

.tier-badge.tier-3 {
    background: var(--gray-400);
}

.tier-content {
    flex: 1;
}

.tier-content strong {
    display: block;
    margin-bottom: 4px;
}

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

.tier-languages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.lang-tag {
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--gray-700);
}

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

@media (max-width: 768px) {
    .terms-grid {
        grid-template-columns: 1fr;
    }
}

.term-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
}

.term-card h5 {
    font-size: 16px;
    color: var(--gray-900);
    margin: 0 0 8px 0;
}

.term-card .how-it-works {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.term-card .when-to-use {
    font-size: 13px;
    color: var(--green);
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}
