/* ============================================================================
   COMMUNITY NEWS -- Scoped Styles
   Roll.Connect Cork Board
   ============================================================================
   Theme: Hybrid -- black header/footer, cork texture board area
   Accent: Neon green #00FF41
   Fonts: Permanent Marker (headers), Patrick Hand (sticky notes), Inter (body)
   ============================================================================ */


/* -- CSS Custom Properties --------------------------------------- */
:root {
    --cn-black: #0a0a0a;
    --cn-black-soft: #141414;
    --cn-green: #a6b4aa;
    --cn-green-dim: #00cc34;
    --cn-green-glow: rgba(0, 255, 65, 0.3);
    --cn-cork: #b8860b;
    --cn-cork-light: #c49a2c;
    --cn-cork-dark: #8b6914;
    --cn-white: #f0f0f0;
    --cn-gray: #9e9e9e;
    --cn-gray-light: #cccccc;
    --cn-shadow: rgba(0, 0, 0, 0.4);
    --cn-radius: 4px;
    --cn-transition: 0.25s ease;
    --cn-max-width: 1200px;
}


/* -- Page Wrapper (scoped for base.html integration) -------------- */
.cn-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cn-black);
    color: var(--cn-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}


/* ==================================================================
   HEADER -- Black with neon green accents
   ================================================================== */

.cn-header {
    background: var(--cn-black);
    border-bottom: 3px solid var(--cn-green);
    padding: 2rem 1.5rem;
    text-align: center;
}

.cn-header__inner {
    max-width: var(--cn-max-width);
    margin: 0 auto;
}

.cn-header__title {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: var(--cn-green);
    margin: 0 0 0.3rem 0;
    text-shadow: 0 0 20px var(--cn-green-glow), 0 0 40px rgba(0, 255, 65, 0.15);
    letter-spacing: 1px;
}

.cn-header__icon {
    font-style: normal;
    margin-right: 0.3rem;
}

.cn-header__subtitle {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--cn-gray-light);
    margin: 0;
    letter-spacing: 0.5px;
}


/* ==================================================================
   FEATURED SECTION -- Cork board with sticky notes
   ================================================================== */

.cn-featured {
    background:
        repeating-conic-gradient(
            var(--cn-cork-dark) 0% 25%, transparent 0% 50%
        ) 0 0 / 4px 4px,
        linear-gradient(160deg, var(--cn-cork) 0%, var(--cn-cork-dark) 50%, var(--cn-cork) 100%);
    padding: 2.5rem 1.5rem;
    border-bottom: 4px solid var(--cn-cork-dark);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cn-featured__inner {
    max-width: var(--cn-max-width);
    margin: 0 auto;
}

.cn-section-title {
    font-family: 'Permanent Marker', cursive;
    font-size: 1.6rem;
    color: #2d1a00;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.2);
}

/* Push pin decoration */
.cn-pin {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2),
        inset 0 2px 3px rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.cn-pin--red { background: radial-gradient(circle at 35% 35%, #ff4444, #cc0000); }
.cn-pin--green { background: radial-gradient(circle at 35% 35%, #00ff41, #00aa2a); }
.cn-pin--yellow { background: radial-gradient(circle at 35% 35%, #ffdd44, #ccaa00); }
.cn-pin--blue { background: radial-gradient(circle at 35% 35%, #4488ff, #0044cc); }

.cn-featured__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}


/* -- Sticky Note Cards (Featured) ------------------------------ */

.cn-sticky {
    background: #fffef0;
    padding: 1.5rem 1.3rem 1.3rem;
    position: relative;
    transform: rotate(calc(var(--rotation, 0) * 1deg));
    box-shadow:
        2px 3px 8px var(--cn-shadow),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    border-left: 5px solid var(--note-color, #00FF41);
    transition: transform var(--cn-transition), box-shadow var(--cn-transition);
    min-height: 180px;
}

.cn-sticky:nth-child(1) { --rotation: -2; }
.cn-sticky:nth-child(2) { --rotation: 1.5; }
.cn-sticky:nth-child(3) { --rotation: -1; }

.cn-sticky:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 4px 6px 16px var(--cn-shadow);
    z-index: 2;
}

.cn-sticky__pin {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ff4444, #cc0000);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    z-index: 3;
}

.cn-sticky__category {
    font-family: 'Patrick Hand', cursive;
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}

.cn-sticky__title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.35rem;
    color: #1a1a1a;
    margin: 0 0 0.6rem 0;
    line-height: 1.3;
}

.cn-sticky__date {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.5rem;
}

.cn-sticky__date-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.cn-sticky__time {
    font-size: 0.85rem;
    color: #666;
}

.cn-sticky__venue {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.cn-sticky__venue-icon {
    font-style: normal;
}

.cn-sticky__desc {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0 0;
    line-height: 1.4;
}

.cn-sticky__countdown {
    margin-top: 0.6rem;
}

.cn-countdown {
    font-family: 'Patrick Hand', cursive;
    font-size: 0.95rem;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.06);
    color: #555;
}

.cn-countdown--today {
    background: #ff4444;
    color: white;
    font-weight: 700;
    animation: cn-pulse 1.5s ease-in-out infinite;
}

.cn-countdown--soon {
    background: #ff8800;
    color: white;
    font-weight: 600;
}

/* Grayscale modifier for Adult Night events */
.cn-sticky--grayscale {
    background: #e8e8e8;
    border-left-color: var(--cn-gray) !important;
}

.cn-sticky--grayscale .cn-sticky__title,
.cn-sticky--grayscale .cn-sticky__date-text {
    color: #444;
}


/* ==================================================================
   CORK BOARD -- Main news area
   ================================================================== */

.cn-board {
    background:
        repeating-conic-gradient(
            var(--cn-cork-dark) 0% 25%, transparent 0% 50%
        ) 0 0 / 4px 4px,
        linear-gradient(170deg, var(--cn-cork) 0%, var(--cn-cork-dark) 40%, var(--cn-cork-light) 100%);
    padding: 2rem 1.5rem 3rem;
    min-height: 60vh;
}

.cn-board__inner {
    max-width: var(--cn-max-width);
    margin: 0 auto;
}


/* -- Filter Bar ------------------------------------------------ */

.cn-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem 1.2rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 255, 65, 0.15);
}

.cn-filters__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cn-tab {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    background: transparent;
    color: var(--cn-gray-light);
    cursor: pointer;
    transition: all var(--cn-transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.cn-tab:hover {
    border-color: var(--tab-color, var(--cn-green));
    color: var(--tab-color, var(--cn-green));
    background: rgba(0, 255, 65, 0.08);
}

.cn-tab--active {
    background: var(--cn-green);
    color: var(--cn-black);
    border-color: var(--cn-green);
    font-weight: 600;
}

.cn-tab--active:hover {
    background: var(--cn-green-dim);
    color: var(--cn-black);
}

.cn-tab__count {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    min-width: 1.4rem;
    text-align: center;
}

.cn-tab--active .cn-tab__count {
    background: rgba(0, 0, 0, 0.2);
    color: var(--cn-black);
}

.cn-filters__search {
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.cn-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 0 0.8rem;
    transition: border-color var(--cn-transition);
}

.cn-search:focus-within {
    border-color: var(--cn-green);
    box-shadow: 0 0 0 2px var(--cn-green-glow);
}

.cn-search__icon {
    font-size: 0.9rem;
    color: var(--cn-gray);
    flex-shrink: 0;
}

.cn-search__input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--cn-white);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    width: 100%;
}

.cn-search__input::placeholder {
    color: var(--cn-gray);
}

.cn-search__clear {
    background: transparent;
    border: none;
    color: var(--cn-gray);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem;
    transition: color var(--cn-transition);
}

.cn-search__clear:hover {
    color: var(--cn-white);
}


/* -- News Grid ------------------------------------------------- */

.cn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.8rem;
}


/* -- News Cards ------------------------------------------------ */

.cn-card {
    background: #fffef0;
    border-radius: var(--cn-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 2px 3px 10px var(--cn-shadow);
    transition: transform var(--cn-transition), box-shadow var(--cn-transition);
    display: flex;
    flex-direction: column;
}

.cn-card:hover {
    transform: translateY(-4px);
    box-shadow: 4px 6px 20px var(--cn-shadow);
}

/* Tape decoration at top of card */
.cn-card__tape {
    height: 22px;
    background:
        linear-gradient(90deg,
            transparent 0%,
            rgba(var(--note-color-rgb, 0, 255, 65), 0.35) 10%,
            rgba(var(--note-color-rgb, 0, 255, 65), 0.45) 50%,
            rgba(var(--note-color-rgb, 0, 255, 65), 0.35) 90%,
            transparent 100%
        );
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
}

/* Fallback tape color using the CSS variable */
.cn-card__tape {
    background: linear-gradient(90deg,
        transparent 0%,
        color-mix(in srgb, var(--note-color, #00FF41) 35%, transparent) 10%,
        color-mix(in srgb, var(--note-color, #00FF41) 45%, transparent) 50%,
        color-mix(in srgb, var(--note-color, #00FF41) 35%, transparent) 90%,
        transparent 100%
    );
}

.cn-card__image {
    width: 100%;
    max-height: 180px;
    overflow: hidden;
}

.cn-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cn-card__body {
    padding: 1rem 1.2rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cn-card__category {
    font-family: 'Patrick Hand', cursive;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    border-left: 3px solid var(--cat-color, #00FF41);
    padding-left: 0.5rem;
    margin-bottom: 0.4rem;
}

.cn-card__title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.2rem;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.cn-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 0.4rem;
}

.cn-card__venue {
    font-size: 0.82rem;
    color: #666;
    margin-bottom: 0.4rem;
}

.cn-card__desc {
    font-size: 0.82rem;
    color: #777;
    margin: 0.3rem 0 0;
    line-height: 1.4;
    flex: 1;
}

.cn-card__countdown {
    margin-top: auto;
    padding-top: 0.6rem;
}

/* Countdown badges */
.cn-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    background: #eee;
    color: #555;
}

.cn-badge--today {
    background: #ff4444;
    color: white;
    animation: cn-pulse 1.5s ease-in-out infinite;
}

.cn-badge--soon {
    background: #ff8800;
    color: white;
}

.cn-badge--week {
    background: #ffcc00;
    color: #333;
}

/* Grayscale modifier */
.cn-card--grayscale {
    background: #e8e8e8;
}

.cn-card--grayscale .cn-card__tape {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(158, 158, 158, 0.35) 10%,
        rgba(158, 158, 158, 0.45) 50%,
        rgba(158, 158, 158, 0.35) 90%,
        transparent 100%
    ) !important;
}

.cn-card--grayscale .cn-card__title {
    color: #444;
}

/* Note color classes (match CSSClass column values) */
.note-green  { --note-color: #00FF41; }
.note-gray   { --note-color: #9E9E9E; }
.note-blue   { --note-color: #4488FF; }
.note-red    { --note-color: #FF4444; }
.note-yellow { --note-color: #FFDD44; }
.note-purple { --note-color: #AA44FF; }
.note-orange { --note-color: #FF8800; }
.note-pink   { --note-color: #FF66AA; }


/* -- Error Banner ---------------------------------------------- */

.cn-error {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #ffcccc;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cn-error__icon {
    font-size: 1.3rem;
}


/* -- Empty State ----------------------------------------------- */

.cn-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.cn-empty__icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.cn-empty__text {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.4rem;
    color: #3d2a0a;
    margin: 0 0 0.3rem;
}

.cn-empty__hint {
    font-size: 0.9rem;
    color: #7a5c28;
    margin: 0;
}


/* -- Load More ------------------------------------------------- */

.cn-loadmore {
    text-align: center;
    margin-top: 2.5rem;
}

.cn-loadmore__btn {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 2.5rem;
    background: var(--cn-black);
    color: var(--cn-green);
    border: 2px solid var(--cn-green);
    border-radius: 30px;
    cursor: pointer;
    transition: all var(--cn-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cn-loadmore__btn:hover {
    background: var(--cn-green);
    color: var(--cn-black);
    box-shadow: 0 0 20px var(--cn-green-glow);
}

.cn-loadmore__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cn-loadmore__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: cn-spin 0.6s linear infinite;
}

.cn-loadmore__status {
    font-size: 0.85rem;
    color: #5a4320;
    margin-top: 0.6rem;
}


/* Footer styles removed -- base.html provides site footer */


/* ==================================================================
   ANIMATIONS
   ================================================================== */

@keyframes cn-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes cn-spin {
    to { transform: rotate(360deg); }
}

@keyframes cn-fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cn-card--entering {
    animation: cn-fadeIn 0.35s ease-out forwards;
}


/* ==================================================================
   RESPONSIVE
   ================================================================== */

@media (max-width: 768px) {
    .cn-featured__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .cn-sticky {
        transform: rotate(0deg) !important;
    }

    .cn-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .cn-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .cn-filters__tabs {
        justify-content: center;
    }

    .cn-filters__search {
        max-width: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .cn-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .cn-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
