:root {
    /* Lovable Inspired Palette */
    --primary: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    --secondary: #EC4899;
    --accent: #F472B6;
    
    /* Gradients */
    --grad-primary: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 1) 100%);
    --grad-hover: linear-gradient(135deg, #7C3AED 0%, #C026D3 100%);

    /* Neutrals */
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --bg-app: #F9FAFB;
    --bg-card: #FFFFFF;
    --border-light: #E5E7EB;
    --border-focus: #8B5CF6;

    /* Shadows & Radius */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lovable: 0 20px 25px -5px rgba(139, 92, 246, 0.1), 0 10px 10px -5px rgba(139, 92, 246, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--bg-app);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* --- Header & Navigation --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--primary);
    background-color: rgba(139, 92, 246, 0.05);
}

.nav-item.active {
    color: var(--primary);
    background-color: rgba(139, 92, 246, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

/* --- Buttons --- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px;
}

.button:active {
    transform: scale(0.98);
}

.button.primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.39);
}

.button.primary:hover {
    background: var(--grad-hover);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.23);
    transform: translateY(-1px);
}

.button.secondary {
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-main);
}

.button.secondary:hover {
    background: var(--bg-app);
    border-color: var(--primary-light);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lovable);
    border-color: var(--primary-light);
}

.card-img-container {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

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

.card-content {
    padding: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text-main);
}

/* --- Forms & Inputs --- */
.auth-container {
    background: white;
    max-width: 480px;
    margin: 60px auto;
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* --- Tags --- */
.quick-tag {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: white;
    border: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-tag:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.02);
}

.quick-tag.active {
    background: var(--grad-primary);
    color: white;
    border-color: transparent;
}

.tag-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

/* --- Nearby & Search Results --- */
.nearby-item {
    padding: 10px 18px;
    border-radius: var(--radius-full);
    background: white;
    border: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.nearby-item:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.nearby-item.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 12px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

/* --- Map Preview --- */
.map-preview-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    margin-top: 24px;
    background: white;
}

.map-preview {
    width: 100%;
    height: 300px;
}

/* --- Share Card --- */
.share-page {
    margin-top: 60px;
}

.share-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
}

.share-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.share-layout {
    display: grid;
    grid-template-columns: minmax(280px, 520px) 1fr;
    gap: 32px;
    align-items: start;
}

.share-preview-panel {
    padding: 18px;
    border-radius: 28px;
    background: linear-gradient(145deg, #FFFFFF 0%, #F8F3EC 100%);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lovable);
}

#share-card-canvas {
    display: none;
}

#share-card-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 22px;
    background: #F6E7D6;
}

.share-side-panel {
    padding: 32px;
    border-radius: var(--radius-lg);
    background: white;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.share-kicker {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.share-side-panel h2 {
    margin: 10px 0 12px;
    font-size: 28px;
    line-height: 1.2;
}

.share-side-panel p {
    color: var(--text-muted);
}

.share-meta-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.share-meta-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(139, 92, 246, 0.06);
}

.share-meta-list strong {
    color: var(--text-main);
}

.share-meta-list span {
    color: var(--primary);
    font-weight: 800;
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* --- Star Rating --- */
.rating-group {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
    align-items: center;
    width: fit-content;
}

.rating-input {
    display: none;
}

.rating-label {
    cursor: pointer;
    width: 32px;
    height: 32px;
    color: #D1D5DB;
    transition: all 0.2s ease;
}

.rating-label svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.rating-input:checked ~ .rating-label,
.rating-label:hover,
.rating-label:hover ~ .rating-label {
    color: #FBBF24;
}

.image-upload-box {
    position: relative;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: all 0.2s ease;
    background: rgba(139, 92, 246, 0.02);
}

.image-upload-box.has-file {
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08);
}

.image-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.image-upload-feedback {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.24);
    color: #047857;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.image-upload-feedback[hidden] {
    display: none !important;
}

.image-upload-feedback strong {
    color: #065f46;
    word-break: break-all;
}

.price-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input-wrapper span {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.price-input-wrapper .input-field {
    padding-left: 28px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .site-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px;
    }

    .brand {
        font-size: 20px;
    }

    .nav-links {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .user-menu {
        max-width: 100%;
        flex-wrap: wrap;
    }
    
    .container {
        padding: 0 16px;
    }

    .page-title {
        font-size: 28px;
    }

    .grid-4 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .auth-container {
        margin: 20px 16px;
        padding: 24px;
    }

    main.container > div[style*="display: flex; justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
    }

    main.container div[style*="display: grid; grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    main.container div[style*="display: flex; gap: 12px"],
    main.container div[style*="display: flex; gap: 16px"] {
        flex-wrap: wrap;
    }

    .map-preview-container {
        margin-top: 16px;
    }

    .share-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .share-actions {
        justify-content: flex-start;
    }

    .share-layout {
        grid-template-columns: 1fr;
    }

    .share-side-panel {
        padding: 24px;
    }

    .image-upload-box {
        padding: 24px 20px;
    }

    .image-upload-feedback {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}
