/* ============================================
   BJJ MATCH LOG - Shared Styles for PHP Pages
   ============================================ */

/* ====== CSS VARIABLES (from SPA) ====== */
:root {
    --bg-deep: #050508;
    --bg-primary: #0a0a0f;
    --bg-secondary: #101018;
    --bg-card: #14141e;
    --bg-card-hover: #1a1a28;
    --bg-elevated: #1e1e2a;

    --text-primary: #f5f5fa;
    --text-secondary: #a0a0b8;
    --text-muted: #606078;

    --gold: #ffd700;
    --gold-bright: #ffe44d;
    --gold-dim: #b8960b;
    --gold-glow: rgba(255, 215, 0, 0.4);
    --silver: #c0c0d0;
    --silver-dim: #9090a0;
    --bronze: #cd7f32;
    --bronze-dim: #a86420;

    --belt-white: #f0f0f0;
    --belt-blue: #1e90ff;
    --belt-purple: #9932cc;
    --belt-brown: #8b4513;
    --belt-black: #1a1a1a;

    --accent-red: #ff3b3b;
    --accent-green: #00c853;

    --border-subtle: rgba(255,255,255,0.04);
    --border-medium: rgba(255,255,255,0.08);
    --border-glow: rgba(255, 215, 0, 0.2);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --shadow-gold: 0 0 60px rgba(255, 215, 0, 0.15);
    --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
}

/* ====== RESET & BODY ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 10%, rgba(0, 156, 59, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse 50% 30% at 50% 100%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent 0px, transparent 1px, rgba(255,255,255,0.015) 1px, rgba(255,255,255,0.015) 2px),
        repeating-linear-gradient(90deg, transparent 0px, transparent 1px, rgba(255,255,255,0.01) 1px, rgba(255,255,255,0.01) 2px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

/* ====== HEADER ====== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(5,5,8,0.98) 0%, rgba(5,5,8,0.9) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 0;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
    opacity: 0.3;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo-mark {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--bg-deep);
    font-weight: 700;
    box-shadow: var(--shadow-gold), 0 4px 12px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.logo-mark::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-family: 'Oswald', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 500;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--gold);
    background: rgba(255, 215, 0, 0.08);
}

/* ====== PAGE CONTAINER ====== */
.page-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    position: relative;
    z-index: 1;
}

/* ====== BREADCRUMB ====== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--gold);
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ====== PAGE HERO ====== */
.page-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dim), var(--gold));
}

.page-hero h1 {
    font-family: 'Oswald', 'Noto Sans JP', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-hero .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.page-hero .meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-elevated);
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ====== MEDAL SUMMARY ====== */
.medal-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.medal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.medal-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.medal-card.gold {
    border-color: rgba(255, 215, 0, 0.2);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.08) 0%, var(--bg-card) 100%);
}

.medal-card.silver {
    border-color: rgba(192, 192, 208, 0.15);
    background: linear-gradient(180deg, rgba(192, 192, 208, 0.06) 0%, var(--bg-card) 100%);
}

.medal-card.bronze {
    border-color: rgba(205, 127, 50, 0.15);
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.06) 0%, var(--bg-card) 100%);
}

.medal-card.total {
    border-color: var(--border-medium);
}

.medal-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.medal-count {
    font-family: 'Oswald', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.medal-card.gold .medal-count { color: var(--gold); text-shadow: 0 0 20px var(--gold-glow); }
.medal-card.silver .medal-count { color: var(--silver); }
.medal-card.bronze .medal-count { color: var(--bronze); }
.medal-card.total .medal-count { color: var(--text-secondary); }

.medal-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* ====== SECTION CARD ====== */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: 'Oswald', 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title .icon {
    color: var(--gold);
}

/* ====== YEAR GROUP ====== */
.year-group {
    border-bottom: 1px solid var(--border-subtle);
}

.year-group:last-child {
    border-bottom: none;
}

.year-header {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.15em;
    padding: 1rem 1.5rem 0.5rem;
    text-transform: uppercase;
}

/* ====== RESULT ITEM ====== */
.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: var(--bg-card-hover);
}

.result-medal {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-tournament {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-tournament a {
    color: var(--text-primary);
    transition: color 0.2s;
}

.result-tournament a:hover {
    color: var(--gold);
}

.result-category {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ====== ATHLETE ROW (for tournament/ranking pages) ====== */
.athlete-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s;
}

.athlete-row:last-child {
    border-bottom: none;
}

.athlete-row:hover {
    background: var(--bg-card-hover);
}

.athlete-rank {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.athlete-rank.rank-1 { color: var(--gold); text-shadow: 0 0 10px var(--gold-glow); }
.athlete-rank.rank-2 { color: var(--silver); }
.athlete-rank.rank-3 { color: var(--bronze); }

.athlete-name {
    flex: 1;
    min-width: 0;
}

.athlete-name a {
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.2s;
}

.athlete-name a:hover {
    color: var(--gold);
}

.athlete-dojo {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.athlete-medals {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.athlete-medal-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
}

.athlete-medal-badge.gold { color: var(--gold); }
.athlete-medal-badge.silver { color: var(--silver); }
.athlete-medal-badge.bronze { color: var(--bronze); }

/* ====== CATEGORY GROUP (tournament page) ====== */
.category-group {
    border-bottom: 1px solid var(--border-subtle);
}

.category-group:last-child {
    border-bottom: none;
}

.category-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 1rem 1.5rem 0.5rem;
    background: var(--bg-secondary);
}

/* ====== ORG SWITCHER ====== */
.org-switcher {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 1.25rem;
}

.org-switcher-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

.org-switcher-btn:hover {
    color: var(--text-secondary);
}

.org-switcher-btn.active {
    background: linear-gradient(135deg, var(--gold-dim) 0%, var(--gold) 100%);
    color: var(--bg-deep);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

/* ====== BELT FILTER ====== */
.belt-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.belt-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.belt-chip:hover, .belt-chip.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(255, 215, 0, 0.08);
}

.belt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.belt-dot.white { background: var(--belt-white); }
.belt-dot.blue { background: var(--belt-blue); }
.belt-dot.purple { background: var(--belt-purple); }
.belt-dot.brown { background: var(--belt-brown); }
.belt-dot.black { background: var(--belt-black); border: 1px solid var(--border-medium); }

/* ====== FOOTER ====== */
.site-footer {
    background: var(--bg-deep);
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 1rem;
    margin-top: 3rem;
    position: relative;
    z-index: 1;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.footer-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--bg-deep);
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.footer-social a:hover {
    background: var(--gold);
    color: var(--bg-deep);
    transform: translateY(-2px);
}

.footer-social svg {
    width: 18px;
    height: 18px;
}

.footer-divider {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
}

.footer-data-credit {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-data-credit a {
    color: var(--gold);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer-data-credit a:hover {
    opacity: 0.8;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ====== ERROR PAGE ====== */
.error-page {
    text-align: center;
    padding: 6rem 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-page h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 5rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 40px var(--gold-glow);
    margin-bottom: 1rem;
}

.error-page p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    color: var(--bg-deep);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--gold-glow);
    color: var(--bg-deep);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }

    .header-nav {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .page-container {
        padding: 1.5rem 1rem 3rem;
    }

    .page-hero {
        padding: 1.5rem;
    }

    .page-hero h1 {
        font-size: 1.5rem;
    }

    .medal-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .medal-count {
        font-size: 2rem;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.875rem 1rem;
    }

    .result-info {
        width: 100%;
    }

    .result-tournament {
        white-space: normal;
        word-break: break-word;
    }

    .result-date {
        align-self: flex-end;
    }

    .athlete-row {
        flex-wrap: wrap;
        padding: 0.875rem 1rem;
    }

    .athlete-medals {
        width: 100%;
        justify-content: flex-end;
    }

    .belt-filters {
        gap: 0.35rem;
    }

    .belt-chip {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .logo-mark {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .logo-main {
        font-size: 1.2rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-divider {
        display: none;
    }

    .medal-summary {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .medal-card {
        padding: 1rem 0.5rem;
    }

    .medal-icon {
        font-size: 1.5rem;
    }

    .medal-count {
        font-size: 1.5rem;
    }
}
