/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #ff5a5f;
    --primary-dark: #e04e52;
    --success: #00a699;
    --warning: #ffb400;
    --danger: #c13515;
    --gray-100: #f7f7f7;
    --gray-200: #ebebeb;
    --gray-300: #dddddd;
    --gray-400: #b0b0b0;
    --gray-500: #717171;
    --gray-600: #484848;
    --gray-700: #222222;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-700);
    line-height: 1.5;
    min-height: 100vh;
}

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.subtitle {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 90, 95, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-full {
    width: 100%;
}

.btn-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.btn-row .btn {
    flex: 1;
}

/* Error message */
.error {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Main container */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 2rem;
}

/* Header */
.header {
    margin-bottom: 1.5rem;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-badge {
    background: var(--gray-200);
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.dates {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.back-link {
    display: inline-block;
    color: var(--gray-600);
    text-decoration: none;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.back-link:hover {
    color: var(--primary);
}

/* Actions bar */
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.toggle-vetoed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    cursor: pointer;
}

.toggle-vetoed input {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary);
}

/* Listings */
.listings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

/* Listing card */
.listing-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.listing-card.vetoed {
    opacity: 0.6;
}

.listing-card.vetoed .listing-title {
    text-decoration: line-through;
}

/* Image carousel */
.listing-images {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--gray-200);
}

.image-carousel {
    width: 100%;
    height: 100%;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}

.carousel-image.active {
    opacity: 1;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--white);
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.9;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    opacity: 1;
}

.carousel-btn.prev {
    left: 0.5rem;
}

.carousel-btn.next {
    right: 0.5rem;
}

.carousel-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.375rem;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--white);
    opacity: 0.5;
}

.dot.active {
    opacity: 1;
}

/* Listing content */
.listing-content {
    padding: 1rem;
}

.listing-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.listing-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
}

.veto-badge {
    flex-shrink: 0;
    background: var(--danger);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.scraping-badge {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.scraping-badge.pending {
    background: #fff3cd;
    color: #856404;
    animation: pulse 1.5s ease-in-out infinite;
}

.scraping-badge.failed {
    background: #fef2f2;
    color: var(--danger);
    cursor: help;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.location {
    font-weight: 500;
}

.travel-time {
    color: var(--gray-500);
}

.travel-time::before {
    content: "• ";
}

.listing-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.listing-details span::after {
    content: " •";
    margin-left: 0.75rem;
    color: var(--gray-300);
}

.listing-details span:last-child::after {
    display: none;
}

.listing-price-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.price-total {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.availability {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.availability.available {
    background: #e6f7f5;
    color: var(--success);
}

.availability.unavailable {
    background: #fef2f2;
    color: var(--danger);
}

.listing-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.airbnb-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.airbnb-link:hover {
    text-decoration: underline;
}

.submitted-by {
    color: var(--gray-500);
}

/* Listing actions */
.listing-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.btn-vote {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-vote:hover {
    background: var(--gray-200);
}

.btn-vote.voted {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.vote-icon {
    font-size: 0.75rem;
}

.btn-veto {
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-veto:hover {
    background: var(--gray-100);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-veto.vetoed {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--white);
}

.btn-refetch {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refetch:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-refetch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.voters {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Submit page */
.submit-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.url-input-section {
    margin-bottom: 1.5rem;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--gray-600);
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.preview-section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.preview-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.preview-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-actions .btn {
    flex: 1;
}

.submit-hint {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Desktop styles */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .listing-content {
        padding: 1.25rem;
    }

    .listing-title {
        font-size: 1.25rem;
    }

    .auth-card {
        padding: 2.5rem;
    }
}
