/* =====================================================
   FFN TOOL PAGES — SHARED DESIGN SYSTEM
   Draft Board · News Feed · Academy
   ===================================================== */

/* — Design Tokens — */
:root {
    --tp-navy: #0e2240;
    --tp-navy-mid: #162d50;
    --tp-navy-light: #1e3a5f;
    --tp-ink: #0f172a;
    --tp-text: #334155;
    --tp-muted: #64748b;
    --tp-soft: #94a3b8;
    --tp-border: #e2e8f0;
    --tp-border-light: #f1f5f9;
    --tp-surface: #f8fafc;
    --tp-bg: #f1f5f9;
    --tp-white: #ffffff;
    --tp-blue: #2563eb;
    --tp-blue-hover: #1d4ed8;
    --tp-blue-light: #3b82f6;
    --tp-blue-glow: #60a5fa;
    --tp-cyan: #38bdf8;
    --tp-amber: #f59e0b;
    --tp-amber-light: #fbbf24;
    --tp-green: #22c55e;
    --tp-red: #ef4444;

    /* Layered shadow system — ambient + key light */
    --tp-shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
    --tp-shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 2px 8px rgba(15,23,42,0.04);
    --tp-shadow-md: 0 2px 4px rgba(15,23,42,0.04), 0 8px 24px -4px rgba(15,23,42,0.1);
    --tp-shadow-lg: 0 4px 8px rgba(15,23,42,0.04), 0 16px 40px -8px rgba(15,23,42,0.14);
    --tp-shadow-xl: 0 8px 16px rgba(15,23,42,0.05), 0 24px 56px -12px rgba(15,23,42,0.18);
    --tp-shadow-blue: 0 4px 14px rgba(37,99,235,0.18), 0 1px 4px rgba(37,99,235,0.12);
    --tp-shadow-card-hover: 0 8px 20px rgba(15,23,42,0.06), 0 24px 48px -12px rgba(15,23,42,0.12);

    /* Radius */
    --tp-r-sm: 8px;
    --tp-r-md: 12px;
    --tp-r-lg: 16px;
    --tp-r-xl: 20px;
    --tp-r-pill: 999px;

    /* Motion */
    --tp-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --tp-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --tp-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --tp-dur-fast: 0.15s;
    --tp-dur: 0.25s;
    --tp-dur-slow: 0.5s;
}

/* — Grain Texture Overlay (for heroes) — */
.tp-grain::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.028;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* — Hero Base — */
.tp-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    isolation: isolate;
}

.tp-hero-content {
    position: relative;
    z-index: 2;
}

/* Animated accent orbs floating in hero backgrounds */
.tp-hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
    z-index: 0;
    will-change: transform;
}

.tp-hero-orb--1 {
    width: 400px;
    height: 400px;
    top: -120px;
    right: -80px;
    background: radial-gradient(circle, rgba(96,165,250,0.18) 0%, transparent 70%);
    animation: tp-orb-drift-1 18s ease-in-out infinite;
}

.tp-hero-orb--2 {
    width: 320px;
    height: 320px;
    bottom: -140px;
    left: -60px;
    background: radial-gradient(circle, rgba(37,99,235,0.14) 0%, transparent 70%);
    animation: tp-orb-drift-2 22s ease-in-out infinite;
}

.tp-hero-orb--3 {
    width: 200px;
    height: 200px;
    top: 30%;
    left: 50%;
    background: radial-gradient(circle, rgba(56,189,248,0.10) 0%, transparent 70%);
    animation: tp-orb-drift-3 15s ease-in-out infinite;
}

@keyframes tp-orb-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-30px, 20px) scale(1.05); }
    66% { transform: translate(15px, -15px) scale(0.97); }
}

@keyframes tp-orb-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40% { transform: translate(25px, -20px) scale(1.08); }
    70% { transform: translate(-15px, 10px) scale(0.95); }
}

@keyframes tp-orb-drift-3 {
    0%, 100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -20px) scale(1.1); opacity: 0.7; }
}

/* Hero horizontal accent line */
.tp-hero-line {
    display: block;
    width: 60px;
    height: 3px;
    margin: 20px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--tp-cyan), transparent);
    opacity: 0.6;
    position: relative;
    z-index: 2;
}

/* — Breadcrumb — */
.tp-bc {
    max-width: var(--tp-bc-max, 1440px);
    margin: 0 auto;
    padding: 12px 24px 0;
    font-size: 13px;
    color: var(--tp-soft);
    font-weight: 500;
}

.tp-bc a {
    color: var(--tp-blue-light);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--tp-dur-fast) var(--tp-ease);
}

.tp-bc a:hover {
    color: var(--tp-blue);
    text-decoration: underline;
}

.tp-bc-sep {
    margin: 0 7px;
    color: #cbd5e1;
    user-select: none;
}

.tp-bc-current {
    color: var(--tp-text);
    font-weight: 600;
}

/* — Panels — */
.tp-panel {
    background: var(--tp-white);
    border: 1px solid rgba(15,23,42,0.06);
    border-radius: var(--tp-r-xl);
    box-shadow: var(--tp-shadow-md);
    transition: box-shadow var(--tp-dur) var(--tp-ease), transform var(--tp-dur) var(--tp-ease);
}

.tp-panel:hover {
    box-shadow: var(--tp-shadow-lg);
}

.tp-panel-head {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--tp-border-light);
}

.tp-panel-head h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--tp-ink);
    letter-spacing: -0.02em;
}

/* — Cards — */
.tp-card {
    background: var(--tp-white);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-lg);
    padding: 18px 20px;
    transition: all var(--tp-dur) var(--tp-ease);
}

.tp-card:hover {
    border-color: rgba(37,99,235,0.2);
    box-shadow: var(--tp-shadow-card-hover);
    transform: translateY(-2px);
}

/* — Stat Cards (overlap hero) — */
.tp-stat-grid {
    display: grid;
    gap: 14px;
    position: relative;
    z-index: 3;
}

.tp-stat {
    background: rgba(255,255,255,0.97);
    border: 1px solid rgba(148,163,184,0.15);
    border-radius: var(--tp-r-lg);
    padding: 18px 20px;
    box-shadow: var(--tp-shadow-lg);
    text-align: center;
    transition: transform var(--tp-dur) var(--tp-spring), box-shadow var(--tp-dur) var(--tp-ease);
}

.tp-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--tp-shadow-xl);
}

.tp-stat .label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--tp-soft);
    text-transform: uppercase;
}

.tp-stat .value {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--tp-ink);
}

.tp-stat .sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--tp-muted);
}

/* — Chips / Pills — */
.tp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: var(--tp-r-pill);
    font-size: 12px;
    font-weight: 700;
    transition: all var(--tp-dur-fast) var(--tp-ease);
}

.tp-chip--blue {
    background: #eff6ff;
    color: var(--tp-blue);
}

.tp-chip--amber {
    background: #fef3c7;
    color: #b45309;
}

.tp-chip--green {
    background: #dcfce7;
    color: #15803d;
}

.tp-chip--red {
    background: #fee2e2;
    color: #b91c1c;
}

.tp-chip--ghost {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    color: var(--tp-muted);
}

/* — Inputs / Controls — */
.tp-input,
.tp-select {
    width: 100%;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-md);
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tp-ink);
    background: var(--tp-white);
    outline: none;
    transition: border-color var(--tp-dur-fast) var(--tp-ease), box-shadow var(--tp-dur-fast) var(--tp-ease);
}

.tp-input:focus,
.tp-select:focus {
    border-color: var(--tp-blue-glow);
    box-shadow: 0 0 0 4px rgba(96,165,250,0.12);
}

.tp-input::placeholder {
    color: var(--tp-soft);
    font-weight: 500;
}

/* — Tab Pills — */
.tp-tab {
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-pill);
    background: var(--tp-surface);
    color: var(--tp-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--tp-dur-fast) var(--tp-ease);
}

.tp-tab:hover {
    border-color: #93c5fd;
    color: var(--tp-blue);
    background: #eff6ff;
}

.tp-tab.active {
    background: var(--tp-navy);
    border-color: var(--tp-navy);
    color: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(14,34,64,0.7);
}

/* — FantasyGPT FAB (unified) — */
.tp-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 14px 20px;
    border-radius: var(--tp-r-pill);
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #1e40af 100%);
    color: #ffffff;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.01em;
    box-shadow: var(--tp-shadow-blue), 0 0 0 0 rgba(37,99,235,0);
    transition: transform var(--tp-dur) var(--tp-spring), box-shadow var(--tp-dur) var(--tp-ease);
}

.tp-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(37,99,235,0.3), 0 2px 8px rgba(37,99,235,0.15), 0 0 0 0 rgba(37,99,235,0);
    color: #ffffff;
}

.tp-fab:active {
    transform: translateY(-1px);
}

.tp-fab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .tp-fab {
        right: 14px;
        bottom: 14px;
        padding: 14px;
        border-radius: 50%;
    }
    .tp-fab span {
        display: none;
    }
}

/* — Scroll Reveal Animations — */
.tp-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--tp-ease-out), transform 0.6s var(--tp-ease-out);
}

.tp-reveal.tp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.tp-reveal-stagger > .tp-reveal:nth-child(1) { transition-delay: 0s; }
.tp-reveal-stagger > .tp-reveal:nth-child(2) { transition-delay: 0.06s; }
.tp-reveal-stagger > .tp-reveal:nth-child(3) { transition-delay: 0.12s; }
.tp-reveal-stagger > .tp-reveal:nth-child(4) { transition-delay: 0.18s; }
.tp-reveal-stagger > .tp-reveal:nth-child(5) { transition-delay: 0.24s; }
.tp-reveal-stagger > .tp-reveal:nth-child(6) { transition-delay: 0.30s; }
.tp-reveal-stagger > .tp-reveal:nth-child(7) { transition-delay: 0.36s; }
.tp-reveal-stagger > .tp-reveal:nth-child(8) { transition-delay: 0.42s; }

/* Hero content fade-in on load */
.tp-hero-anim {
    opacity: 0;
    transform: translateY(18px);
    animation: tp-hero-enter 0.7s var(--tp-ease-out) forwards;
}

.tp-hero-anim:nth-child(1) { animation-delay: 0.1s; }
.tp-hero-anim:nth-child(2) { animation-delay: 0.2s; }
.tp-hero-anim:nth-child(3) { animation-delay: 0.3s; }
.tp-hero-anim:nth-child(4) { animation-delay: 0.4s; }
.tp-hero-anim:nth-child(5) { animation-delay: 0.5s; }

@keyframes tp-hero-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* — Empty / Loading States — */
.tp-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--tp-soft);
    font-size: 15px;
    line-height: 1.7;
}

.tp-loading-pulse {
    animation: tp-pulse 1.8s ease-in-out infinite;
}

@keyframes tp-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* — Live Indicator — */
.tp-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--tp-green);
}

.tp-live::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tp-green);
    box-shadow: 0 0 8px rgba(34,197,94,0.5);
    animation: tp-live-pulse 2s ease-in-out infinite;
}

@keyframes tp-live-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(34,197,94,0.5); }
    50% { opacity: 0.4; box-shadow: 0 0 2px rgba(34,197,94,0.2); }
}

/* — Control Label — */
.tp-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--tp-soft);
    text-transform: uppercase;
}

/* — Divider accent — */
.tp-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tp-border), transparent);
    margin: 16px 0;
}

/* =====================================================
   MOBILE TOUCH TARGET & LAYOUT FIXES
   Min 44px interactive targets, proper stacking
   ===================================================== */

@media (max-width: 768px) {
    /* — Shared inputs/selects: 44px min — */
    .tp-input,
    .tp-select {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 16px; /* prevent iOS zoom */
    }

    /* — Tab pills: 44px min — */
    .tp-tab {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 13px;
    }

    /* — Chips: slightly larger for readability — */
    .tp-chip {
        padding: 7px 12px;
        font-size: 12px;
    }

    /* — FAB: enforce 48px on mobile — */
    .tp-fab {
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        right: 16px;
        bottom: 16px;
    }
    .tp-fab svg {
        width: 20px;
        height: 20px;
    }
    .tp-fab span {
        display: none;
    }

    /* — Breadcrumb: tighter on mobile — */
    .tp-bc {
        padding: 10px 16px 0;
    }
}

@media (max-width: 480px) {
    .tp-input,
    .tp-select {
        padding: 12px 12px;
    }
}

/* — Reduced Motion — */
@media (prefers-reduced-motion: reduce) {
    .tp-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .tp-hero-anim {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .tp-hero-orb {
        animation: none;
    }
    .tp-live::before {
        animation: none;
    }
    .tp-stat:hover,
    .tp-card:hover,
    .tp-fab:hover {
        transform: none;
    }
}

/* — Print — */
@media print {
    .tp-fab,
    .tp-hero-orb,
    .tp-grain::after {
        display: none;
    }
    .tp-reveal {
        opacity: 1;
        transform: none;
    }
}
