/* FoodSwap - Stop Wasting Food */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --secondary: #0ea5e9;
    --dark: #0f172a;
    --darker: #020617;
    --light-text: #f9fafb;
    --muted-text: #9ca3af;
    --border: rgba(148, 163, 184, 0.2);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2933, #020617);
    color: var(--light-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Logo image + text alignment */
.site-logo { vertical-align: middle; display: inline-block; }
.logo-text { display: inline-block; vertical-align: middle; }
.logo { display: flex; align-items: center; gap: 0.75rem; }

.logo h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.logo p {
    font-size: 0.9rem;
    color: var(--muted-text);
}

.nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Page Section for About/Contact pages */
.page-section {
    padding: 4rem 0;
    background: radial-gradient(circle at top, #1f2933, #020617);
}

.page-section h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary);
    text-align: center;
}

.page-section h2 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem 0;
    color: var(--light-text);
}

.page-section p {
    margin-bottom: 1rem;
    color: var(--muted-text);
}

.page-section ul {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.page-section li {
    margin-bottom: 0.5rem;
    color: var(--muted-text);
}

/* Map Section */
.map-section {
    height: 500px;
    margin-bottom: 2rem;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.45);
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(30, 41, 59, 0.8);
}

/* Leaflet fixes */
.leaflet-container {
    background: #1a202c;
    z-index: 1;
}

.leaflet-top,
.leaflet-bottom {
    z-index: 1000;
}

/* Listings Section */
.listings-section {
    padding: 2rem 0;
}

.listings-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.filter-controls {
    margin-bottom: 2rem;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-box,
.filter-select {
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--light-text);
    font-size: 0.95rem;
    min-width: 180px;
}

.search-box:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.food-card {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.food-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(34, 197, 94, 0.15);
}

.food-card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.food-card-header h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.food-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.category-badge {
    display: inline-block;
    background: rgba(34, 197, 94, 0.2);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.expiry-timer {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    border-radius: 0.4rem;
    font-size: 0.9rem;
    color: #fca5a5;
}

.food-card-body {
    padding: 1.25rem;
}

.quantity-location {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.description {
    color: var(--muted-text);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.contact-info {
    background: rgba(30, 41, 59, 0.6);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.contact-info p {
    margin-bottom: 0.3rem;
    color: var(--muted-text);
}

.food-card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.favorite-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--primary);
}

.favorite-btn.saved {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.food-card {
    position: relative;
}

.listings-grid.list-view {
    grid-template-columns: 1fr;
}

.listings-grid.list-view .food-card {
    display: flex;
}

.listings-grid.list-view .food-card-header {
    flex: 0 0 200px;
    border-right: 1px solid var(--border);
    border-bottom: none;
}

.listings-grid.list-view .food-card-body {
    flex: 1;
}

/* Listing Actions Top */
.listing-actions-top {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4ade80);
    color: #022c22;
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #bbf7d0;
}

.btn-secondary:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--primary);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    flex: 1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    padding: 2rem;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.close {
    color: var(--muted-text);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    margin-bottom: 1rem;
}

.close:hover {
    color: var(--light-text);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--light-text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--light-text);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

#location {
    background: rgba(34, 197, 94, 0.05) !important;
    border: 2px dashed var(--primary) !important;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* NGO List */
.ngo-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.ngo-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.ngo-card:hover {
    border-color: var(--primary);
    background: rgba(34, 197, 94, 0.05);
}

.ngo-card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.ngo-card p {
    font-size: 0.9rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.verification-badge {
    display: inline-block;
    background: rgba(34, 197, 94, 0.2);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

/* Footer */
.footer {
    margin-top: auto;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--muted-text);
}

/* Social icons bar */
.social-bar {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(10px);
    animation: socialSlideIn 600ms ease forwards 200ms;
}

.social-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms ease, opacity 220ms ease;
    position: relative;
    box-shadow: 0 6px 18px rgba(2,6,23,0.45);
    background: rgba(255,255,255,0.03);
}

.social-icon svg { width: 20px; height: 20px; fill: var(--light-text); transition: transform 180ms ease; }

.social-icon:hover { transform: translateY(-6px) scale(1.07); box-shadow: 0 12px 28px rgba(2,6,23,0.6); }
.social-icon:active { transform: translateY(-2px) scale(0.98); }

/* Brand color variants */
.social-icon.twitter { background: linear-gradient(135deg,#1da1f2 0%, rgba(29,161,242,0.15) 100%); }
.social-icon.facebook { background: linear-gradient(135deg,#1877f2 0%, rgba(24,119,242,0.12) 100%); }
.social-icon.instagram { background: linear-gradient(45deg,#f58529 0%,#dd2a7b 50%,#8134af 100%); }
.social-icon.whatsapp { background: linear-gradient(135deg,#25d366 0%, rgba(37,211,102,0.12) 100%); }
.social-icon.linkedin { background: linear-gradient(135deg,#0a66c2 0%, rgba(10,102,194,0.12) 100%); }

/* subtle floating motion for the bar */
@keyframes floatSlow {
    0% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}

.social-bar { animation: socialSlideIn 600ms ease forwards 200ms, floatSlow 6s ease-in-out infinite; }

@keyframes socialSlideIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ping ring on hover (animated pseudo-element) */
.social-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    pointer-events: none;
}

.social-icon:hover::after {
    animation: ping 900ms ease-out forwards;
}

@keyframes ping {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.35; }
    80% { transform: translate(-50%, -50%) scale(1.9); opacity: 0.08; }
    100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}

/* Utilities */
.hidden {
    display: none !important;
}

.error {
    color: #fca5a5;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.success {
    color: var(--primary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .nav {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .map-section {
        height: 350px;
    }

    .listings-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .search-box,
    .filter-select {
        width: 100%;
        min-width: auto;
    }

    .food-card-footer {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }

    .ngo-list {
        grid-template-columns: 1fr;
    }
}

/* User Status and Account Styles */
.user-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 0.6rem;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

#userNameDisplay {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.btn-text {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    color: var(--muted-text);
    cursor: pointer;
}

.btn-text:hover {
    color: var(--light-text);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--muted-text);
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn:hover {
    color: var(--light-text);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Login/Register Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--light-text);
}

.input-group input {
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--light-text);
    font-size: 0.95rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    border-left: 4px solid var(--primary);
    color: var(--primary);
    padding: 1rem;
    border-radius: 0.6rem;
    margin-bottom: 1rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    color: #fca5a5;
    padding: 1rem;
    border-radius: 0.6rem;
    margin-bottom: 1rem;
}

/* Profile Stats */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 0.8rem;
    padding: 1.5rem;
    text-align: center;
}

.stat-item .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-item .label {
    font-size: 0.9rem;
    color: var(--muted-text);
}

/* Listing Actions */
.listing-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-edit,
.btn-delete {
    flex: 1;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    color: var(--primary);
    border-color: rgba(34, 197, 94, 0.5);
}

.btn-edit:hover {
    background: rgba(34, 197, 94, 0.1);
}

.btn-delete {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted-text);
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--light-text);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Edit Listing Modal */
.edit-form-group {
    margin-bottom: 1.25rem;
}

.edit-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--light-text);
}

.edit-form-group input,
.edit-form-group textarea,
.edit-form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--light-text);
    font-size: 0.95rem;
    font-family: inherit;
}

.edit-form-group input:focus,
.edit-form-group textarea:focus,
.edit-form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* NGO Selection List */
.ngo-select-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.ngo-select-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ngo-select-item:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--primary);
}

.ngo-select-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.ngo-select-item.checked {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--primary);
}

.ngo-select-info {
    flex: 1;
}

.ngo-select-info h4 {
    margin-bottom: 0.25rem;
    color: var(--light-text);
}

.ngo-select-info p {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-bottom: 0.25rem;
}

/* Select input styling */
select {
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--light-text);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Foxa Chatbot Styles */
.foxa-widget {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 2000;
}
.foxa-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.18);
}

.foxa-modal-content {
    max-width: 420px;
    width: 100%;
    background: linear-gradient(180deg, rgba(7,10,21,0.95), rgba(10,14,25,0.98));
}

.foxa-chat-window {
    height: 320px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 0.6rem;
    border: 1px solid rgba(148,163,184,0.06);
    margin-bottom: 0.75rem;
}

.foxa-message {
    display: block;
    margin-bottom: 0.75rem;
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: 0.6rem;
    font-size: 0.95rem;
}
.foxa-message.user {
    margin-left: auto;
    background: rgba(34,197,94,0.12);
    color: var(--light-text);
}
.foxa-message.foxa {
    margin-right: auto;
    background: rgba(2,6,23,0.8);
    border: 1px solid rgba(148,163,184,0.06);
    color: var(--light-text);
}

.foxa-form {
    display: flex;
    gap: 0.5rem;
}
.foxa-form input[type="text"] {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: rgba(15,23,42,0.9);
    color: var(--light-text);
}

@media (max-width: 600px) {
    .foxa-modal-content { max-width: 96%; }
    .foxa-chat-window { height: 260px; }
}
