/* 
  OkatomoNeo Global Styles v2
  - Warm Modern Design System
  - より丸みがあり、親しみやすいUI
*/

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif;
    background: var(--bg-gradient, var(--bg-primary));
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* Typography Utilities */
h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

@media (max-width: 768px) {
    h1 {
        font-size: 24px;
    }
}

.page-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
    /* Container will handle top padding of content */
    width: 100%;
}

.page-header-content {
    max-width: 1140px;
    margin: 0 auto;
    padding: 36px 24px 32px;
}

.content {
    max-width: 1140px;
    margin: 0 auto;
    padding: 36px 24px;
}

.page-title {
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14.5px;
    margin-bottom: 0;
}

/* Force standard content width for containers */
.content,
.container {
    max-width: 1140px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input,
textarea {
    font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================
   TOPBAR
======================== */
.topbar {
    height: 72px;
    /* Increased from 60px */
    background: var(--bg-card);
    /* Stronger background */
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.topbar-brand {
    font-size: 22px;
    /* Increased */
    font-weight: 900;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.8px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.topbar-brand:hover {
    opacity: 0.85;
}

.brand-neo {
    background: var(--logo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 0.9em;
    font-weight: 900;
    margin-left: 1px;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 160px;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.topbar-user:hover {
    background: var(--bg-hover);
}

.topbar-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* ========================
   HAMBURGER MENU
======================== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 26px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 110;
    margin-left: 12px;
}

.menu-toggle span {
    width: 26px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    transform-origin: center;
}

.menu-toggle.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ========================
   NAVIGATION MENU
======================== */
.nav-menu {
    margin-left: 12px;
    display: flex;
    gap: 4px;
    height: 100%;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 14.5px;
    /* Slightly larger */
    font-weight: 600;
    /* Bolder font weight */
    text-decoration: none;
    height: 44px;
    /* Explicit height */
    display: flex;
    align-items: center;
    position: relative;
    transition: all 0.2s;
    white-space: nowrap;
    padding: 0 16px;
    border-radius: var(--radius-md);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent-light);
    background: rgba(14, 165, 233, 0.12);
    font-weight: 700;
}

/* ========================
   TOPBAR ACTIONS
======================== */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.btn-login-link {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: var(--radius-md);
}

.btn-login-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.btn-login-link,
.register-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========================
   RESPONSIVE HEADER
======================== */
@media (max-width: 960px) {
    .topbar {
        padding: 0 16px;
        gap: 12px;
    }

    .topbar-brand {
        font-size: 18px;
    }

    .menu-toggle {
        display: flex;
        order: 10;
        margin-left: 8px;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 290px;
        height: calc(100vh - 60px);
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 2px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 105;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.4);
        overflow-y: auto;
    }

    .nav-menu.open {
        left: 0;
    }

    .nav-link {
        width: 100%;
        height: auto !important;
        padding: 12px 16px;
        font-size: 14.5px;
        border-radius: var(--radius-md);
        line-height: 1.4;
    }

    @media (max-width: 480px) {
        .topbar-brand {
            font-size: 17px;
        }

        .topbar-actions {
            gap: 6px;
        }

        .topbar-user {
            max-width: 90px;
            gap: 6px;
        }

        .topbar-user span {
            font-size: 12px;
        }

        .register-btn {
            display: none !important;
        }
    }

    .mobile-only {
        display: block;
        width: 100%;
    }

    .mobile-auth-links {
        margin-bottom: 8px;
    }

    .mobile-divider {
        border: none;
        border-top: 1px solid var(--border);
        margin: 12px 0;
        opacity: 0.5;
    }
}

@media (min-width: 961px) {
    .mobile-only {
        display: none;
    }
}

/* ========================
   LOGOUT
======================== */
.btn-logout {
    padding: 6px 14px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(251, 113, 133, 0.1);
    border-color: var(--accent2);
    color: var(--accent2);
}

.logout-nav-btn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
}

/* ========================
   CONTENT WRAPPER
======================== */
.content {
    padding: 36px 24px;
    max-width: 1140px;
    margin: 0 auto;
}

/* ========================
   FORMS
======================== */
.form-input {
    width: 100%;
    padding: 11px 15px;
    background: var(--bg-input, #fff);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ========================
   BUTTONS
======================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent2)));
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 7px 16px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-light);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-light);
}

.btn-danger {
    background: rgba(251, 113, 133, 0.15);
    border: 1.5px solid rgba(251, 113, 133, 0.4);
    color: #fb7185;
}

.btn-danger:hover {
    background: rgba(251, 113, 133, 0.25);
    border-color: #fb7185;
}

/* ========================
   ALERTS
======================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(251, 113, 133, 0.1);
    border: 1px solid rgba(251, 113, 133, 0.3);
    color: #fb7185;
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #34d399;
}

/* ========================
   NEWS CARDS
======================== */
.news-card,
.news-mini-card,
.board-snippet {
    position: relative;
    overflow: hidden;
}

.news-card::before,
.news-mini-card::before,
.board-snippet::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    opacity: 0.8;
    transition: opacity 0.2s, height 0.2s;
    z-index: 10;
}

.news-card:hover::before,
.news-mini-card:hover::before,
.board-snippet:hover::before {
    opacity: 1;
    height: 4px;
}

/* 10 Color Variations with Column Support */
/* Targets: 
   1. News cards in flex list (.news-card)
   2. News/Board cards in grid columns (.row > div .card)
*/
.news-card:nth-child(10n+1)::before,
.row>div:nth-child(10n+1) .news-mini-card::before,
.row>div:nth-child(10n+1) .board-snippet::before {
    background: linear-gradient(135deg, #0ea5e9, #10b981);
}

.news-card:nth-child(10n+2)::before,
.row>div:nth-child(10n+2) .news-mini-card::before,
.row>div:nth-child(10n+2) .board-snippet::before {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.news-card:nth-child(10n+3)::before,
.row>div:nth-child(10n+3) .news-mini-card::before,
.row>div:nth-child(10n+3) .board-snippet::before {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

.news-card:nth-child(10n+4)::before,
.row>div:nth-child(10n+4) .news-mini-card::before,
.row>div:nth-child(10n+4) .board-snippet::before {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.news-card:nth-child(10n+5)::before,
.row>div:nth-child(10n+5) .news-mini-card::before,
.row>div:nth-child(10n+5) .board-snippet::before {
    background: linear-gradient(135deg, #f43f5e, #fb923c);
}

.news-card:nth-child(10n+6)::before,
.row>div:nth-child(10n+6) .news-mini-card::before,
.row>div:nth-child(10n+6) .board-snippet::before {
    background: linear-gradient(135deg, #10b981, #14b8a6);
}

.news-card:nth-child(10n+7)::before,
.row>div:nth-child(10n+7) .news-mini-card::before,
.row>div:nth-child(10n+7) .board-snippet::before {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.news-card:nth-child(10n+8)::before,
.row>div:nth-child(10n+8) .news-mini-card::before,
.row>div:nth-child(10n+8) .board-snippet::before {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
}

.news-card:nth-child(10n+9)::before,
.row>div:nth-child(10n+9) .news-mini-card::before,
.row>div:nth-child(10n+9) .board-snippet::before {
    background: linear-gradient(135deg, #a3e635, #22c55e);
}

.news-card:nth-child(10n+10)::before,
.row>div:nth-child(10n+10) .news-mini-card::before,
.row>div:nth-child(10n+10) .board-snippet::before {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent) !important;
}



.news-card-image,
.news-card-placeholder {
    width: 100%;
    height: 160px;
    flex-shrink: 0;
}

@media (min-width: 768px) {

    .news-card-image,
    .news-card-placeholder {
        width: 240px;
        height: auto;
    }
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card-placeholder {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}

.news-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ========================
   BOOTSTRAP OVERRIDES
======================== */
.card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    color: inherit !important;
    box-shadow: var(--shadow-sm);
}

.btn {
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ========================
   LEVEL SYSTEM
======================== */
.profile-level-badge {
    background: linear-gradient(135deg, var(--accent-light), var(--accent2));
    color: white;
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    display: inline-block;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.profile-level-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 6px;
    display: block;
}

.xp-progress-wrapper {
    max-width: 240px;
    margin: 8px auto 16px;
    text-align: center;
}

.xp-progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    height: 8px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 4px;
}

.xp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-text {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========================
   GLOBAL MODALS
======================== */
.okatomo-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.okatomo-modal-backdrop.open {
    display: flex;
}

.okatomo-modal-window {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    padding: 36px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(16px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.okatomo-modal-window h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.okatomo-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.okatomo-modal-actions .btn {
    flex: 1;
}

.btn-cancel {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* ========================
   USER DROPDOWN
======================== */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.topbar-user {
    background: none;
    border: none;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    max-width: 220px;
    /* Allow longer names */
}

.topbar-user span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.topbar-user:hover {
    background: var(--bg-hover);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    display: none;
    flex-direction: column;
    z-index: 3000;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    animation: dropdown-fade-in 0.2s ease-out;
}

@keyframes dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-menu.active {
    display: flex;
}

.dropdown-header {
    padding: 8px 12px 12px 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dropdown-item {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    transition: all 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--accent-light) !important;
}

.dropdown-item i {
    width: 20px;
    font-size: 16px;
    opacity: 0.8;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
    border: none;
}

/* ========================
   PAGE GUIDE BOX
======================== */
.page-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.page-guide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--accent2));
}

.page-guide__icon {
    font-size: 32px;
    background: var(--bg-hover);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.page-guide__content {
    flex: 1;
}

.page-guide__title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.page-guide__text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0;
}

.page-guide__rules {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.page-guide__rules-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 600px) {
    .page-guide {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .page-guide__icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}