/* Community Hub Styles - Cork Board Theme */

/* ========== Google Fonts Import ========== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&family=Source+Sans+Pro:wght@400;600;700&display=swap');

/* ========== Cork Board Theme ========== */

/* Main page background */
.cork-board-page {
    background: #f5f0e8;
    min-height: 100vh;
}

/* Wood Frame Container */
.cork-frame {
    background: url('/static/textures/wood-texture.jpg') center/cover;
    padding: 24px;
    margin: 20px auto;
    max-width: 80rem; /* Match index page max-w-7xl */
    border-radius: 8px;
    box-shadow:
        0 10px 40px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.1),
        inset 0 -2px 0 rgba(0,0,0,0.3);
    position: relative;
}

.cork-frame::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    pointer-events: none;
    border-radius: 4px;
}

/* Cork Board Surface */
.cork-board {
    background: url('/static/textures/cork-texture.jpg') repeat;
    background-size: 512px 512px;
    min-height: calc(100vh - 128px);
    padding: 40px;
    border-radius: 4px;
    position: relative;
    box-shadow:
        inset 0 2px 8px rgba(0,0,0,0.2),
        inset 0 0 40px rgba(0,0,0,0.1);
}

.cork-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(0,0,0,0.08) 100%);
    pointer-events: none;
    border-radius: 4px;
}

/* ========== Board Header ========== */
.board-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.board-title {
    font-family: 'Caveat', cursive;
    font-size: 3.5rem;
    color: #3d2817;
    text-shadow: 2px 2px 0 rgba(255,255,255,0.4);
    display: inline-block;
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    padding: 12px 50px;
    border-radius: 4px;
    box-shadow:
        3px 5px 12px rgba(0,0,0,0.25),
        0 0 0 1px rgba(0,0,0,0.05);
    transform: rotate(-1deg);
    position: relative;
    margin: 0;
}

.board-title::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 30% 30%, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    box-shadow:
        0 4px 8px rgba(0,0,0,0.35),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        inset 0 2px 4px rgba(255,255,255,0.3);
}

.board-subtitle {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    font-weight: 600;
    color: #3d2817;
    margin-top: 15px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.4);
}

/* Subtitle inside filter strip */
.filter-strip-subtitle {
    width: 100%;
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    font-weight: 600;
    color: #3d2817;
    margin: 0 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 2px dashed rgba(180,160,120,0.4);
    text-align: center;
}

/* ========== Filter Strip (Masking Tape Style) ========== */
.filter-strip {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    padding: 20px 30px;
    margin: 0 -20px 40px -20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.5);
    border-top: 3px solid rgba(180,160,120,0.4);
    border-bottom: 3px solid rgba(180,160,120,0.4);
    position: relative;
    z-index: 1;
}

.filter-strip::before,
.filter-strip::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 3px,
        rgba(180,160,120,0.2) 3px,
        rgba(180,160,120,0.2) 6px
    );
}

.filter-strip::before { left: 0; }
.filter-strip::after { right: 0; }

.filter-label {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    color: #5c4033;
    white-space: nowrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
}

.filter-group label {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: #5c4033;
}

.filter-group input,
.filter-group select {
    background: rgba(255,255,255,0.9);
    border: 2px solid #c9b896;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #5c4033;
    min-width: 140px;
    max-width: 180px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #346734;
    box-shadow: 0 0 0 3px rgba(52,103,52,0.15);
}

.filter-btn {
    background: rgba(255,255,255,0.85);
    border: 2px solid #c9b896;
    padding: 8px 18px;
    border-radius: 20px;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #5c4033;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.filter-btn:hover {
    background: #346734;
    color: white;
    border-color: #346734;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.filter-btn.active,
.filter-btn-primary {
    background: #346734;
    color: white;
    border-color: #2a5c3b;
    box-shadow: 0 2px 6px rgba(52,103,52,0.4);
}

.filter-btn-primary:hover {
    background: #2a5c3b;
}

/* ========== Results Strip ========== */
.results-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border-radius: 8px;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.15);
}

.results-count {
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    color: #3d2817;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.3);
}

.results-count span {
    font-weight: 700;
    color: #346734;
}

.results-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Sort dropdown specific styling */
.sort-select {
    background: rgba(255,255,255,0.9);
    border: 2px solid #c9b896;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #5c4033;
    min-width: 140px;
    max-width: 200px;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: #346734;
    box-shadow: 0 0 0 3px rgba(52,103,52,0.15);
}

/* ========== View Toggle Buttons ========== */
.view-toggle {
    display: flex;
    gap: 10px;
}

.view-toggle-btn {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border: 2px solid #c9b896;
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #5c4033;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.view-toggle-btn:hover,
.view-toggle-btn.active {
    background: #3d2817;
    color: white;
    border-color: #3d2817;
}

.view-toggle-btn svg,
.view-toggle-btn i {
    width: 18px;
    height: 18px;
}

/* ========== Events Grid ========== */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 45px;
    padding: 20px 0;
    position: relative;
    z-index: 1;
}

/* ========== Event Card (Pinned Note Style) ========== */
.event-card {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    padding: 28px 22px 22px;
    border-radius: 3px;
    box-shadow:
        4px 6px 18px rgba(0,0,0,0.2),
        0 0 0 1px rgba(0,0,0,0.03),
        inset 0 0 30px rgba(255,255,255,0.1);
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.event-card:nth-child(odd) {
    transform: rotate(-1.5deg);
}

.event-card:nth-child(even) {
    transform: rotate(1.2deg);
}

.event-card:nth-child(3n) {
    transform: rotate(-0.8deg);
}

.event-card:nth-child(4n) {
    transform: rotate(1.8deg);
}

.event-card:hover {
    transform: rotate(0deg) translateY(-10px) scale(1.03);
    box-shadow:
        6px 12px 30px rgba(0,0,0,0.28),
        0 0 0 1px rgba(0,0,0,0.03);
    z-index: 10;
}

/* Shimmer effect on hover */
.event-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.15),
        transparent
    );
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 3px;
}

.event-card:hover::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Folded corner effect */
.event-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 20px 20px;
    border-color: transparent transparent rgba(0,0,0,0.08) transparent;
    border-radius: 0 0 3px 0;
}

/* Event Card Image */
.event-card-image {
    width: calc(100% + 44px);
    height: 140px;
    margin: -28px -22px 16px -22px;
    overflow: hidden;
    border-radius: 3px 3px 0 0;
    position: relative;
}

.event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.event-card:hover .event-card-image img {
    transform: scale(1.05);
}

/* Tape effect over image corners */
.event-card-image::before,
.event-card-image::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 15px;
    background: rgba(255,248,220,0.85);
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.event-card-image::before {
    top: 8px;
    left: -5px;
    transform: rotate(-15deg);
}

.event-card-image::after {
    top: 8px;
    right: -5px;
    transform: rotate(15deg);
}

/* ========== Push Pins ========== */
.push-pin {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    box-shadow:
        0 5px 10px rgba(0,0,0,0.35),
        inset 0 -3px 6px rgba(0,0,0,0.25),
        inset 0 3px 6px rgba(255,255,255,0.4);
    z-index: 5;
}

.push-pin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    filter: blur(1px);
}

/* Pin colors based on category */
.pin-red { background: radial-gradient(circle at 30% 30%, #e63946 0%, #c1121f 100%); }
.pin-green { background: radial-gradient(circle at 30% 30%, #4a9c5d 0%, #346734 100%); }
.pin-blue { background: radial-gradient(circle at 30% 30%, #4895ef 0%, #3a86c4 100%); }
.pin-yellow { background: radial-gradient(circle at 30% 30%, #f4d35e 0%, #e6b800 100%); }
.pin-orange { background: radial-gradient(circle at 30% 30%, #f8961e 0%, #e07b00 100%); }
.pin-pink { background: radial-gradient(circle at 30% 30%, #f472b6 0%, #db2777 100%); }
.pin-purple { background: radial-gradient(circle at 30% 30%, #a78bfa 0%, #7c3aed 100%); }
.pin-teal { background: radial-gradient(circle at 30% 30%, #2dd4bf 0%, #0d9488 100%); }

/* ========== Event Card Content ========== */
.event-image {
    width: calc(100% + 44px);
    margin: -28px -22px 15px -22px;
    height: 160px;
    object-fit: cover;
    border-radius: 3px 3px 0 0;
}

.event-category-badge {
    display: inline-block;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    padding: 4px 14px;
    border-radius: 3px;
    margin-bottom: 12px;
    transform: rotate(-1deg);
    background: rgba(61, 40, 23, 0.08);
    color: #5c4033;
    border: 1px dashed rgba(180, 160, 120, 0.5);
}

/* Category colors */
.bg-farm_tour { background: #d4edda; color: #155724; }
.bg-tasting { background: #f3e8ff; color: #6b21a8; }
.bg-workshop { background: #cce5ff; color: #004085; }
.bg-market { background: #fff3cd; color: #856404; }
.bg-festival { background: #f8d7da; color: #721c24; }
.bg-upick { background: #fce7f3; color: #9d174d; }
.bg-farm_dinner { background: #fef3c7; color: #92400e; }
.bg-cooking_class { background: #ccfbf1; color: #0f766e; }
.bg-food_truck { background: #e0e7ff; color: #3730a3; }
.bg-sustainable { background: #d1fae5; color: #065f46; }

.event-title {
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #2d2d2d;
    margin-bottom: 12px;
    line-height: 1.3;
}

.event-details {
    font-size: 0.9rem;
    color: #5c4033;
    line-height: 1.6;
}

.event-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.event-detail-row svg,
.event-detail-row i {
    width: 16px;
    height: 16px;
    color: #8b7355;
    flex-shrink: 0;
    margin-top: 2px;
}

.event-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9b896, transparent);
    margin: 15px 0;
}

.event-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-attendees {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Caveat', cursive;
    font-size: 1.15rem;
    color: #5c4033;
}

.event-attendees svg,
.event-attendees i {
    width: 16px;
    height: 16px;
    color: #8b7355;
}

.event-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.event-comments-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Caveat', cursive;
    font-size: 1.15rem;
    color: #5c4033;
}

.event-comments-count svg,
.event-comments-count i {
    width: 16px;
    height: 16px;
    color: #8b7355;
}

.event-rsvp {
    background: #346734;
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 4px;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.event-rsvp:hover {
    background: #2a5c3b;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.25);
}

/* Free badge */
.free-badge {
    position: absolute;
    top: 12px;
    right: -6px;
    background: #346734;
    color: white;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    padding: 3px 12px;
    transform: rotate(3deg);
    box-shadow: 2px 3px 6px rgba(0,0,0,0.2);
    z-index: 2;
}

/* Price tag */
.price-tag {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: #346734;
    font-weight: 600;
}

/* ========== Map View ========== */
#events-map {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 4px solid #5c4033;
}

#events-map-view {
    position: relative;
    z-index: 1;
}

/* ========== Loading & Empty States ========== */
#events-loading,
#events-no-results,
#events-error {
    position: relative;
    z-index: 1;
}

#events-loading {
    text-align: center;
    padding: 60px 20px;
}

#events-loading .animate-pulse {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
}

#events-no-results,
#events-error {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border-radius: 8px;
    box-shadow: 4px 6px 18px rgba(0,0,0,0.15);
}

/* ========== Pagination ========== */
#events-pagination {
    position: relative;
    z-index: 1;
    margin-top: 30px;
}

#events-pagination button {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border: 2px solid #c9b896;
    color: #5c4033;
    transition: all 0.2s ease;
}

#events-pagination button:hover:not(:disabled) {
    background: #3d2817;
    color: white;
    border-color: #3d2817;
}

#events-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#page-info {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: #5c4033;
}

/* ========== RSVP Modal ========== */
#rsvp-modal {
    backdrop-filter: blur(4px);
}

#rsvp-modal > div {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border: 4px solid #5c4033;
}

#rsvp-modal h3 {
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    color: #3d2817;
}

.rsvp-status-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid #c9b896;
    background: rgba(255,255,255,0.8);
    color: #5c4033;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rsvp-status-btn:hover {
    border-color: #346734;
}

.rsvp-status-btn.active {
    background: #346734;
    color: white;
    border-color: #346734;
}

/* ========== Active Filters ========== */
#active-filters {
    position: relative;
    z-index: 1;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #c9b896;
}

#filter-tags span {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    border: 1px solid #346734;
    font-family: 'Source Sans Pro', sans-serif;
}

#clear-filters-btn {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
}

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;
    font-family: 'Source Sans Pro', sans-serif;
}

.toast-success { background: #346734; color: white; }
.toast-error { background: #c1121f; color: white; }
.toast-info { background: #3d2817; color: white; }

/* ========== Responsive Adjustments ========== */
@media (max-width: 768px) {
    .cork-frame {
        margin: 10px;
        padding: 15px;
    }

    .cork-board {
        padding: 20px;
    }

    .board-title {
        font-size: 2.5rem;
        padding: 10px 30px;
    }

    .board-subtitle {
        font-size: 1.2rem;
    }

    .filter-strip {
        padding: 15px 20px;
        margin: 0 -10px 30px -10px;
        gap: 12px;
    }

    .filter-group {
        flex: 1;
        min-width: 120px;
    }

    .events-grid {
        gap: 35px;
        grid-template-columns: 1fr;
    }

    .event-card {
        transform: rotate(0deg) !important;
    }

    .event-card:hover {
        transform: translateY(-5px) scale(1.01);
    }

    .results-strip {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    #events-map {
        height: 400px !important;
    }
}

/* ========== Smooth Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cork-board {
    animation: fadeIn 0.3s ease-out;
}

/* ========== Focus States for Accessibility ========== */
.filter-btn:focus,
.view-toggle-btn:focus,
.event-rsvp:focus,
.rsvp-status-btn:focus,
button:focus {
    outline: 2px solid #346734;
    outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #346734;
    box-shadow: 0 0 0 3px rgba(52,103,52,0.15);
}

/* ========== Line Clamp Utility ========== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Event Detail Page Styles ========== */
.event-detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.1);
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: #5c4033;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #346734;
}

.breadcrumb-separator {
    color: #c9b896;
}

.breadcrumb-current {
    color: #3d2817;
    font-weight: 600;
}

.event-detail-card {
    background: url('/static/textures/paper-texture.png') repeat;
    background-size: 256px 256px;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 3px 5px 12px rgba(0,0,0,0.15);
    position: relative;
}

.event-detail-heading {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    color: #3d2817;
    margin-bottom: 16px;
    font-weight: 600;
}

.event-detail-text {
    font-family: 'Source Sans Pro', sans-serif;
    color: #5c4033;
    line-height: 1.7;
}
