/* ══════════════════════════════════════════════════════════════════════════════
   FARMERS MARKET STYLES
   Styles for market markers, detail views, voting, and chat
   ══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────── Market Marker on Map ──────────────── */
.market-marker-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.market-marker-wrapper:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.market-marker {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border: 4px solid white;
    box-shadow:
        0 6px 20px rgba(16, 185, 129, 0.4),
        0 0 0 3px rgba(16, 185, 129, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.market-marker::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    pointer-events: none;
}

.market-marker-image {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
}

.market-marker-icon {
    font-size: 32px;
    line-height: 1;
}

.market-count-badge {
    position: absolute;
    bottom: -10px;
    background: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #059669;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* Pulse animation for active markets */
.market-marker.active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.3);
    animation: marketPulse 2s ease-out infinite;
    z-index: -1;
}

@keyframes marketPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(1.15);
        opacity: 0;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* ──────────────── Market Info Window ──────────────── */
.market-infowindow {
    min-width: 300px;
    max-width: 380px;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.market-infowindow-header {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
}

.market-infowindow-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
}

.market-infowindow-subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.market-infowindow-body {
    padding: 16px;
}

.market-infowindow-stands {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.market-stand-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.market-stand-more {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.market-infowindow-btn {
    width: 100%;
    padding: 12px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.market-infowindow-btn:hover {
    background: #059669;
}

/* ──────────────── Market Detail Page ──────────────── */
.market-detail-header {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 32px 24px;
    border-radius: 0 0 24px 24px;
}

.market-detail-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
}

.market-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    opacity: 0.9;
}

.market-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ──────────────── Voting Section ──────────────── */
.voting-section {
    background: #f9fafb;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.voting-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voting-options {
    display: grid;
    gap: 12px;
}

.voting-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.voting-option:hover {
    border-color: #10B981;
}

.voting-option.selected {
    border-color: #10B981;
    background: #ecfdf5;
}

.voting-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voting-option.selected .voting-option-radio {
    border-color: #10B981;
    background: #10B981;
}

.voting-option.selected .voting-option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.voting-option-content {
    flex: 1;
    min-width: 0;
}

.voting-option-name {
    font-weight: 600;
    color: #111827;
}

.voting-option-meta {
    font-size: 12px;
    color: #6b7280;
}

.voting-option-votes {
    font-size: 13px;
    font-weight: 600;
    color: #10B981;
    padding: 4px 10px;
    background: #ecfdf5;
    border-radius: 20px;
}

/* Image voting grid */
.voting-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.voting-image {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.voting-image:hover {
    transform: scale(1.05);
}

.voting-image.selected {
    border-color: #10B981;
}

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

.voting-image-votes {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Coin flip indicator */
.coin-flip-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ──────────────── Chat Section ──────────────── */
.chat-section {
    background: white;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.chat-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.chat-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.chat-tab:hover {
    color: #111827;
}

.chat-tab.active {
    color: #10B981;
    border-bottom-color: #10B981;
}

.chat-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 6px;
}

.chat-room-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid #fcd34d;
    font-size: 13px;
    color: #92400e;
}

.chat-room-notice i {
    font-size: 14px;
    color: #b45309;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-message-content {
    flex: 1;
    min-width: 0;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-message-name {
    font-weight: 600;
    color: #111827;
}

.chat-message-flair {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #ecfdf5;
    color: #059669;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

.chat-message-time {
    font-size: 12px;
    color: #9ca3af;
}

.chat-message-text {
    color: #374151;
    line-height: 1.5;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #10B981;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #10B981;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #059669;
}

/* ──────────────── Stand List in Market ──────────────── */
.market-stands-list {
    display: grid;
    gap: 12px;
}

.market-stand-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 12px;
    transition: background 0.2s;
}

.market-stand-card:hover {
    background: #f3f4f6;
}

.market-stand-image {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
}

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

.market-stand-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.market-stand-owner {
    font-size: 13px;
    color: #6b7280;
}

.market-stand-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.market-stand-item-tag {
    padding: 2px 8px;
    background: white;
    border-radius: 10px;
    font-size: 11px;
    color: #6b7280;
}

/* ──────────────── Deploy Button ──────────────── */
.deploy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.deploy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.deploy-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.deploy-btn.deployed {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.deploy-btn.deployed:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ──────────────── Market Notification Settings ──────────────── */
.notification-settings {
    background: white;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 20px;
}

.notification-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.notification-toggle:last-child {
    border-bottom: none;
}

.notification-toggle-label {
    font-weight: 500;
    color: #374151;
}

.notification-toggle-desc {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

/* ──────────────── Responsive ──────────────── */
@media (max-width: 640px) {
    .market-marker {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }

    .market-marker-image {
        width: 36px;
        height: 36px;
    }

    .market-count-badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    .voting-images {
        grid-template-columns: repeat(3, 1fr);
    }

    .chat-messages {
        height: 250px;
    }
}
