/* Custom Styles for NJ Rental Dashboard */

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Smooth transitions */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* ========================================
   PHASE 1: Mobile-Friendly Layout
   ======================================== */

/* Mobile Sidebar Drawer */
@media (max-width: 1023px) {
    .sidebar-drawer {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: none;
    }

    .sidebar-drawer.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Touch-friendly tap targets */
    .property-card {
        min-height: 88px; /* 44px * 2 for comfortable tapping */
    }

    button, select, input {
        min-height: 44px;
    }

    /* Adjust filter inputs for mobile */
    #filter-price-min,
    #filter-price-max,
    #filter-bedrooms,
    #filter-city {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* Desktop sidebar stays visible */
@media (min-width: 1024px) {
    .sidebar-drawer {
        position: relative;
        transform: none;
    }
}

/* Property card hover effect */
.property-card {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.property-card:hover {
    background-color: #f9fafb;
}

.property-card.selected {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

/* ========================================
   PHASE 3: Favorites Heart Icon
   ======================================== */

.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    font-size: 18px;
    z-index: 10;
}

.favorite-btn:hover {
    transform: scale(1.1);
    background: white;
}

.favorite-btn.favorited {
    color: #ec4899;
    animation: heartPop 0.3s ease;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Favorites filter active state */
#favorites-toggle.active,
#sweetie-filter.active {
    background-color: #fce7f3;
    border-color: #ec4899;
}

#sweetie-filter.active {
    background-color: #f3e5f5;
    border-color: #9c27b0;
}

/* Mini sweetie icon on property cards */
.sweetie-mini {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* ========================================
   PHASE 4: Sweetie Factor - Fluttershy Voting
   ======================================== */

.sweetie-section {
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 50%, #e8eaf6 100%);
    border: 3px solid #e91e63;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.2);
}

.sweetie-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #9c27b0;
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.sweetie-subtitle {
    font-size: 0.875rem;
    color: #7b1fa2;
    text-align: center;
    margin-bottom: 1.5rem;
}

.sweetie-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pony-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid transparent;
    border-radius: 1rem;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    min-width: 90px;
}

.pony-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
}

.pony-btn:active {
    animation: ponyBounce 0.3s ease;
}

.pony-btn.selected {
    transform: scale(1.1);
    border-color: #e91e63;
    background: white;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.4), 0 0 40px rgba(233, 30, 99, 0.2);
}

.pony-btn.selected .pony-img {
    filter: drop-shadow(0 0 8px #e91e63);
}

.pony-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    transition: filter 0.2s, transform 0.2s;
}

@media (min-width: 640px) {
    .pony-img {
        width: 80px;
        height: 80px;
    }

    .pony-btn {
        min-width: 100px;
        padding: 1rem;
    }
}

.pony-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #7b1fa2;
}

.pony-btn.selected .pony-label {
    color: #e91e63;
}

@keyframes ponyBounce {
    0% { transform: scale(1); }
    30% { transform: scale(0.9); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1.1); }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Sparkle effect on selection */
.pony-btn.selected::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd700'%3E%3Cpath d='M12 0l2.5 9.5L24 12l-9.5 2.5L12 24l-2.5-9.5L0 12l9.5-2.5z'/%3E%3C/svg%3E");
    background-size: contain;
    animation: sparkle 1s ease-in-out infinite;
}

.pony-btn.selected::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: -3px;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff69b4'%3E%3Cpath d='M12 0l2.5 9.5L24 12l-9.5 2.5L12 24l-2.5-9.5L0 12l9.5-2.5z'/%3E%3C/svg%3E");
    background-size: contain;
    animation: sparkle 1.5s ease-in-out infinite 0.3s;
}

/* Current vote display */
.sweetie-current {
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0.5rem;
}

.sweetie-current img {
    width: 40px;
    height: 40px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* ========================================
   Photo gallery
   ======================================== */

.gallery-main {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

.gallery-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.gallery-thumbnail:hover {
    opacity: 0.8;
}

.gallery-thumbnail.active {
    border-color: #3b82f6;
}

/* Score badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Rating badges */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid;
}

/* Amenity card */
.amenity-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.amenity-card:hover {
    background: #f3f4f6;
}

.amenity-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 4px;
}

.amenity-logo-placeholder {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    border-radius: 4px;
    font-size: 1.25rem;
}

/* Notes textarea */
.notes-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
}

.notes-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Save indicator */
.save-indicator {
    font-size: 0.75rem;
    color: #6b7280;
    transition: opacity 0.3s ease;
}

.save-indicator.saving {
    color: #f59e0b;
}

.save-indicator.saved {
    color: #10b981;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 0.8s ease-in-out infinite;
}

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

/* Landlord research section */
.landlord-claims {
    list-style: none;
    padding: 0;
    margin: 0;
}

.landlord-claim {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.landlord-claim:last-child {
    border-bottom: none;
}

.claim-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.claim-icon.positive {
    color: #10b981;
}

.claim-icon.negative {
    color: #ef4444;
}

.claim-icon.neutral {
    color: #6b7280;
}

/* Citation link */
.citation-link {
    font-size: 0.75rem;
    color: #3b82f6;
    text-decoration: none;
    margin-left: 0.25rem;
}

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

/* Financial calculator */
.financial-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.financial-row:last-child {
    border-bottom: none;
}

.financial-row.total {
    font-weight: 600;
    border-top: 2px solid #e5e7eb;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.financial-label {
    color: #6b7280;
}

.financial-value {
    color: #111827;
    font-weight: 500;
}

.financial-value.success {
    color: #10b981;
}

.financial-value.warning {
    color: #f59e0b;
}

.financial-value.danger {
    color: #ef4444;
}

/* Map container */
#map-container {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Print styles */
@media print {
    header,
    #sidebar,
    #refresh-btn,
    .notes-textarea,
    .sweetie-section {
        display: none !important;
    }

    main {
        padding: 0 !important;
        overflow: visible !important;
    }

    #main-content {
        max-width: 100% !important;
    }

    section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
    /* Can add dark mode styles here */
}

/* ========================================
   Property Card Placeholders
   ======================================== */

.property-card-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: 2px solid #a5b4fc;
}

.property-card-placeholder .placeholder-icon {
    font-size: 1.75rem;
    margin-bottom: 0.125rem;
}

.property-card-placeholder .placeholder-beds {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4338ca;
}

/* ========================================
   Gallery Placeholder Styles
   ======================================== */

.gallery-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 20rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
}

.gallery-placeholder-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.gallery-placeholder-info {
    margin-bottom: 1.5rem;
}

.gallery-placeholder-address {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.gallery-placeholder-city {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.gallery-placeholder-details {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.gallery-placeholder-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
}

.gallery-view-listing-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.gallery-view-listing-btn:hover {
    background: #1d4ed8;
}

/* Photo error fallback */
.photo-error .photo-error-fallback {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 20rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 2rem;
    text-align: center;
}

.photo-error #gallery-main-photo {
    display: none;
}
