/* ===========================================
   CHARACTER CATALOG - Infinity Star X
   Styles for the character catalog page,
   faction groups, portrait grid, and
   character profile modal.
   =========================================== */

/* ---- Root Variables (inherited from main) ---- */
:root {
    --primary-dark: #0a0e1a;
    --secondary-dark: #151b2e;
    --tertiary-dark: #1f2937;
    --accent-cyan: #00d9ff;
    --accent-purple: #b794f6;
    --accent-gold: #fbbf24;
    --accent-red: #ef4444;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --header-height: 80px;
    --transition-speed: 0.3s;

    /* Faction Colors */
    --faction-pirates: #ff4500;
    --faction-anima: #b794f6;
    --faction-simp: #ef4444;
    --faction-goon: #fbbf24;
    --faction-citizens: #22c55e;
}

/* ---- Global Reset (scoped to catalog page) ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--primary-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---- Utility ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ---- Navigation (consistent with main site) ---- */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(0, 217, 255, 0.3);
    z-index: 1000;
    transition: all var(--transition-speed);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo img {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(0, 217, 255, 0.5));
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    transition: color var(--transition-speed);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    transition: width var(--transition-speed);
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-cyan);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--accent-cyan);
    border-radius: 3px;
    transition: all var(--transition-speed);
}

/* ============================================
   CATALOG PAGE HERO
   ============================================ */
.catalog-hero {
    padding: 10rem 0 4rem;
    text-align: center;
    background: linear-gradient(180deg, var(--primary-dark), var(--secondary-dark));
    position: relative;
    overflow: hidden;
}

.catalog-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(183, 148, 246, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.catalog-hero-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.catalog-hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    letter-spacing: 1px;
}

/* ============================================
   FACTION SECTIONS
   ============================================ */
.catalog-content {
    padding: 4rem 0 6rem;
    background: var(--secondary-dark);
}

.faction-group {
    margin-bottom: 4rem;
}

.faction-group:last-child {
    margin-bottom: 0;
}

/* Faction Header */
.faction-header {
    margin-bottom: 2rem;
}

.faction-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
}

/* Faction-specific title colors */
.faction-group[data-faction="pirates"] .faction-title {
    color: var(--faction-pirates);
    text-shadow: 0 0 20px rgba(255, 69, 0, 0.4);
}

.faction-group[data-faction="anima"] .faction-title {
    color: var(--faction-anima);
    text-shadow: 0 0 20px rgba(183, 148, 246, 0.4);
}

.faction-group[data-faction="simp"] .faction-title {
    color: var(--faction-simp);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.faction-group[data-faction="goon"] .faction-title {
    color: var(--faction-goon);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.faction-group[data-faction="citizens"] .faction-title {
    color: var(--faction-citizens);
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.faction-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 1px;
}

.faction-divider {
    height: 2px;
    margin-top: 0.8rem;
    border: none;
    border-radius: 2px;
}

/* Faction-specific divider colors */
.faction-group[data-faction="pirates"] .faction-divider {
    background: linear-gradient(90deg, var(--faction-pirates), transparent);
}

.faction-group[data-faction="anima"] .faction-divider {
    background: linear-gradient(90deg, var(--faction-anima), transparent);
}

.faction-group[data-faction="simp"] .faction-divider {
    background: linear-gradient(90deg, var(--faction-simp), transparent);
}

.faction-group[data-faction="goon"] .faction-divider {
    background: linear-gradient(90deg, var(--faction-goon), transparent);
}

.faction-group[data-faction="citizens"] .faction-divider {
    background: linear-gradient(90deg, var(--faction-citizens), transparent);
}

/* ============================================
   CHARACTER PORTRAIT GRID
   ============================================ */
.faction-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

/* Individual Character Portrait Card */
.character-card {
    background: rgba(31, 41, 55, 0.6);
    border: 2px solid rgba(183, 148, 246, 0.2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-speed);
    backdrop-filter: blur(10px);
    position: relative;
}

.character-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-purple);
    box-shadow: 0 20px 40px rgba(183, 148, 246, 0.25);
}

/* Faction-specific card hover glow */
.faction-group[data-faction="pirates"] .character-card:hover {
    border-color: var(--faction-pirates);
    box-shadow: 0 20px 40px rgba(255, 69, 0, 0.25);
}

.faction-group[data-faction="anima"] .character-card:hover {
    border-color: var(--faction-anima);
    box-shadow: 0 20px 40px rgba(183, 148, 246, 0.25);
}

.faction-group[data-faction="simp"] .character-card:hover {
    border-color: var(--faction-simp);
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.25);
}

.faction-group[data-faction="goon"] .character-card:hover {
    border-color: var(--faction-goon);
    box-shadow: 0 20px 40px rgba(251, 191, 36, 0.25);
}

.faction-group[data-faction="citizens"] .character-card:hover {
    border-color: var(--faction-citizens);
    box-shadow: 0 20px 40px rgba(34, 197, 94, 0.25);
}

/* Portrait container - uses video if available, image fallback */
.character-portrait {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
}

.character-portrait video,
.character-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.character-card:hover .character-portrait video,
.character-card:hover .character-portrait img {
    transform: scale(1.05);
}

/* Character name bar at bottom of card */
.character-card-info {
    padding: 1rem 1.2rem;
    text-align: center;
    background: rgba(10, 14, 26, 0.6);
}

.character-card-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    letter-spacing: 1px;
}

.character-card-role {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Empty slot placeholder (for factions with no characters yet) */
.character-card.empty-slot {
    border-style: dashed;
    border-color: rgba(100, 116, 139, 0.3);
    cursor: default;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-card.empty-slot:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(100, 116, 139, 0.3);
}

.empty-slot-content {
    text-align: center;
    padding: 2rem;
}

.empty-slot-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.empty-slot-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* ============================================
   CHARACTER PROFILE MODAL
   ============================================ */
.character-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.character-modal.active {
    display: flex;
}

/* Backdrop overlay */
.character-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
}

/* Modal container */
.character-modal-content {
    position: relative;
    background: linear-gradient(135deg, var(--secondary-dark), var(--primary-dark));
    border: 2px solid var(--accent-purple);
    border-radius: 15px;
    max-width: 1000px;
    width: 95%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 80px rgba(183, 148, 246, 0.4);
    animation: charModalSlide 0.35s ease-out;
}

/* Custom scrollbar for modal */
.character-modal-content::-webkit-scrollbar {
    width: 6px;
}

.character-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.character-modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 3px;
}

@keyframes charModalSlide {
    from {
        transform: translateY(-40px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close button */
.character-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: rgba(183, 148, 246, 0.15);
    border: 2px solid var(--accent-purple);
    border-radius: 50%;
    color: var(--accent-purple);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-modal-close:hover {
    background: var(--accent-purple);
    color: var(--primary-dark);
    transform: rotate(90deg);
}

/* ---- Modal Layout: Splash (left) + Profile (right) ---- */
.character-modal-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
    min-height: 500px;
}

/* Left panel - Animated splash display */
.character-modal-splash {
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 13px 0 0 13px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.character-modal-splash video,
.character-modal-splash img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Right panel - Character profile details */
.character-modal-profile {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

/* ---- Profile Header: Name, Faction, Home Planet ---- */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.profile-header-text {
    flex: 1;
}

.profile-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.profile-faction {
    font-size: 1rem;
    color: var(--accent-purple);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Home planet thumbnail */
.profile-home-planet {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0, 217, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-home-planet img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-home-planet .planet-placeholder {
    font-size: 2rem;
}

/* ---- Character Description ---- */
.profile-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ---- Game Sprite Display ---- */
.profile-sprite {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-sprite-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.profile-sprite-frame {
    width: 80px;
    height: 80px;
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 217, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-speed);
}

.profile-sprite-frame:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.profile-sprite-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Infinity Star Roster (4 frames in a row) ---- */
.profile-roster {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-roster-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-roster-frames {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
}

.roster-frame {
    aspect-ratio: 1;
    background: rgba(0, 217, 255, 0.05);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.roster-frame:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.roster-frame img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 217, 255, 0.3));
}

.roster-frame .roster-empty {
    font-size: 1.5rem;
    opacity: 0.3;
}

/* ---- Details Box Grid ---- */
.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.detail-box {
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 8px;
    padding: 0.7rem;
    text-align: center;
    transition: all var(--transition-speed);
}

.detail-box:hover {
    border-color: rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.08);
}

.detail-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.detail-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

/* ---- Quote Block ---- */
.profile-quote {
    background: rgba(183, 148, 246, 0.08);
    border-left: 3px solid var(--accent-purple);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.2rem;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

.profile-quote::before {
    content: '"';
    font-size: 2rem;
    color: var(--accent-purple);
    line-height: 0;
    vertical-align: -0.3em;
    margin-right: 0.2rem;
}

/* ---- Traits Row: Class, Strategy, Fav Element ---- */
.profile-traits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}

.trait-box {
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(183, 148, 246, 0.2);
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
    transition: all var(--transition-speed);
}

.trait-box:hover {
    border-color: var(--accent-purple);
    background: rgba(183, 148, 246, 0.1);
}

.trait-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.trait-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    color: var(--accent-purple);
    font-weight: 700;
}

/* ============================================
   FOOTER (consistent with main site)
   ============================================ */
.footer {
    background: var(--primary-dark);
    border-top: 2px solid rgba(0, 217, 255, 0.3);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand img {
    height: 40px;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links h4,
.footer-social h4 {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer-links a:hover {
    color: var(--accent-cyan);
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 50%;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all var(--transition-speed);
}

.social-icon:hover {
    background: var(--accent-cyan);
    color: var(--primary-dark);
    transform: translateY(-3px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 968px) {
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .catalog-hero-title {
        font-size: 2.5rem;
    }

    .faction-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    .character-modal-body {
        grid-template-columns: 1fr;
    }

    .character-modal-splash {
        border-radius: 13px 13px 0 0;
        min-height: 300px;
        max-height: 350px;
    }

    .profile-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .profile-traits {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .catalog-hero-title {
        font-size: 1.8rem;
    }

    .faction-title {
        font-size: 1.4rem;
    }

    .faction-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .profile-name {
        font-size: 1.6rem;
    }

    .profile-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-traits {
        grid-template-columns: 1fr;
    }

    .profile-roster-frames {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .character-modal-content {
        width: 98%;
        max-height: 95vh;
    }
}
