* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* User Header */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-bottom: 15px;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.logout-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

.add-property-btn {
    background: #4CAF50;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
}

.add-property-btn:hover {
    background: #388E3C;
    transform: scale(1.1);
}

.add-property-btn.upload-btn {
    background: #2196F3;
}

.add-property-btn.upload-btn:hover {
    background: #1976D2;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
    color: white;
    flex: 1;
    padding: 10px 5px;
    border-radius: 8px;
    transition: all 0.2s;
}

.stat-btn {
    text-decoration: none;
    cursor: pointer;
}

.stat-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

.stat-btn.liked:hover {
    background: rgba(76, 175, 80, 0.3);
}

.stat-btn.passed:hover {
    background: rgba(244, 67, 54, 0.3);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 12px;
    opacity: 0.7;
}

/* Card Stack */
.card-stack {
    flex: 1;
    position: relative;
    perspective: 1000px;
    min-height: 400px;
}

/* Card peek - show next card behind */
.property-card.peek-card {
    transform: scale(0.92) translateY(15px);
    opacity: 0.6;
    z-index: 1;
    pointer-events: none;
    filter: blur(1px);
}

.property-card.active-card {
    z-index: 10;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

.property-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    transition: transform 0.1s ease-out;
    display: flex;
    flex-direction: column;
}

.property-card:active {
    cursor: grabbing;
}

/* Card swipe states */
.property-card.swiping-right {
    border: 4px solid #4CAF50;
}

.property-card.swiping-left {
    border: 4px solid #f44336;
}

.property-card.swipe-out-right {
    animation: swipeOutRight 0.4s ease-out forwards;
}

.property-card.swipe-out-left {
    animation: swipeOutLeft 0.4s ease-out forwards;
}

@keyframes swipeOutRight {
    to {
        transform: translateX(150%) rotate(30deg);
        opacity: 0;
    }
}

@keyframes swipeOutLeft {
    to {
        transform: translateX(-150%) rotate(-30deg);
        opacity: 0;
    }
}

/* Swipe indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg) scale(0.5);
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 4px;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 10;
    text-transform: uppercase;
    border: 6px solid;
    pointer-events: none;
}

.swipe-indicator.like {
    background: rgba(76, 175, 80, 0.95);
    color: white;
    border-color: #2e7d32;
    box-shadow: 0 8px 30px rgba(76, 175, 80, 0.6);
    transform: translate(-50%, -50%) rotate(-20deg) scale(0.5);
}

.swipe-indicator.dislike {
    background: rgba(244, 67, 54, 0.95);
    color: white;
    border-color: #c62828;
    box-shadow: 0 8px 30px rgba(244, 67, 54, 0.6);
    transform: translate(-50%, -50%) rotate(20deg) scale(0.5);
}

.property-card.swiping-right .swipe-indicator.like {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-20deg) scale(1);
}

.property-card.swiping-left .swipe-indicator.dislike {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(20deg) scale(1);
}

/* Final stamp animation on swipe out */
.property-card.swipe-out-right .swipe-indicator.like,
.property-card.swipe-out-left .swipe-indicator.dislike {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1.2);
    animation: stampPulse 0.3s ease-out;
}

@keyframes stampPulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1.2); }
}

/* Card Content */
.card-header {
    background: linear-gradient(135deg, #1a5490 0%, #2c5aa0 100%);
    color: white;
    padding: 20px;
    flex-shrink: 0;
}

.card-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.card-header .address {
    font-size: 14px;
    opacity: 0.9;
}

.card-header .apn {
    font-size: 13px;
    opacity: 0.75;
    font-family: monospace;
}

.batch-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-top: 10px;
    background: rgba(255,255,255,0.2);
}

.batch-badge.nod {
    background: #FF9800;
}

.batch-badge.nts {
    background: #f44336;
}

.batch-badge.reo {
    background: #9C27B0;
}

/* Property type colors */
.batch-badge.type-residential {
    background: #4CAF50;
}

.batch-badge.type-multifamily {
    background: #2196F3;
}

.batch-badge.type-condo {
    background: #00BCD4;
}

.batch-badge.type-commercial {
    background: #FF9800;
}

.batch-badge.type-industrial {
    background: #607D8B;
}

.batch-badge.type-land {
    background: #8BC34A;
}

.batch-badge.type-agriculture {
    background: #795548;
}

.card-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.property-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.property-item {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
}

.property-item label {
    display: block;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.property-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.property-item.full-width {
    grid-column: span 2;
}

.maps-link {
    display: block;
    margin-top: 15px;
    padding: 12px;
    background: #4285f4;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.maps-link:hover {
    background: #3367d6;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(0.95);
}

.dislike-btn {
    background: #f44336;
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.like-btn {
    background: #4CAF50;
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.notes-btn {
    background: #2196F3;
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #2196F3;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.cancel-btn {
    background: #e0e0e0;
    color: #333;
}

.save-btn {
    background: #4CAF50;
    color: white;
}

/* End Screen */
.end-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.end-screen h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.view-liked-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 15px 30px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

/* End Screen Buttons */
.end-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.end-btn {
    display: inline-block;
    padding: 15px 30px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.end-btn:hover {
    transform: scale(1.05);
}

.end-btn.liked-btn {
    background: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.end-btn.passed-btn {
    background: #f44336;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.hidden {
    display: none !important;
}

/* Liked Page Styles */
.liked-page {
    height: auto;
    min-height: 100vh;
}

.liked-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    margin-bottom: 15px;
    color: white;
}

.liked-header .back-btn {
    margin-right: 5px;
}

.liked-header .region-indicator {
    font-size: 12px;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Export buttons row */
.header-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.header-actions .export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

.header-actions .export-btn:hover {
    background: #388E3C;
    transform: translateY(-1px);
}

.header-actions .export-btn svg {
    flex-shrink: 0;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 18px;
}

.liked-header h1 {
    font-size: 18px;
    margin: 0;
    white-space: nowrap;
}

.liked-header .count {
    background: #4CAF50;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    margin-left: auto;
}

.liked-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
}

.liked-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.liked-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.liked-card-header h3 {
    font-size: 16px;
    color: #333;
}

.liked-card .address {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.liked-card .apn {
    color: #888;
    font-size: 13px;
    font-family: monospace;
    margin-bottom: 12px;
}

.liked-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.liked-details .detail {
    text-align: center;
    padding: 8px 4px;
}

.liked-details .label {
    display: block;
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.liked-details .value {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.liked-card .notes {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    margin-bottom: 12px;
}

.liked-actions {
    display: flex;
    gap: 10px;
}

.map-link {
    flex: 1;
    padding: 10px;
    background: #4285f4;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
}

.remove-btn {
    padding: 10px 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.empty-state, .error {
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 16px;
}

.empty-state a {
    color: #4CAF50;
}

/* AI Summary */
.ai-summary {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    border-left: 4px solid #2c5aa0;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.ai-summary h3 {
    color: #1a5490;
    font-size: 13px;
    margin: 0 0 8px 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-summary p {
    margin: 0;
    color: #333;
    font-size: 13px;
    line-height: 1.5;
}

/* Links Row */
.links-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.links-row .map-link {
    flex: 1;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    color: white;
}

.links-row .map-link.maps {
    background: #4285f4;
}

.links-row .map-link.maps:hover {
    background: #3367d6;
}

.links-row .map-link.earth {
    background: #34a853;
}

.links-row .map-link.earth:hover {
    background: #2d9249;
}

.links-row .map-link.titlepro {
    background: #ff6f00;
    cursor: pointer;
}

.links-row .map-link.titlepro:hover {
    background: #e65100;
}

/* TitlePro button states */
.links-row .map-link.titlepro.success {
    background: #4CAF50;
}

.links-row .map-link.titlepro.success:hover {
    background: #388E3C;
}

.links-row .map-link.titlepro.failed {
    background: #f44336;
    cursor: pointer;
}

.links-row .map-link.titlepro.failed:hover {
    background: #d32f2f;
}

.links-row .map-link.titlepro.mismatch {
    background: #FF9800;
    cursor: pointer;
}

.links-row .map-link.titlepro.mismatch:hover {
    background: #F57C00;
}

.links-row .map-link.titlepro.no-date {
    background: #9E9E9E;
    cursor: pointer;
}

.links-row .map-link.titlepro.no-date:hover {
    background: #757575;
}

.links-row .map-link.titlepro.loading {
    background: #607D8B;
    pointer-events: none;
    opacity: 0.8;
}

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

.links-row .map-link.titlepro.loading {
    animation: pulse 1.5s infinite;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Passed Page Header */
.liked-header .count.passed {
    background: #f44336;
}

/* Navigation tabs */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.nav-tab {
    flex: 1;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.2);
}

.nav-tab.active {
    background: #4CAF50;
}

/* Region Button */
.region-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    margin-right: 10px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* Region Modal */
.region-modal-content {
    max-width: 350px;
}

.region-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.region-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.region-option {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.region-option:hover {
    background: #e8f4fd;
    border-color: #2c5aa0;
}

.region-option.selected {
    background: #e8f4fd;
    border-color: #2c5aa0;
}

.region-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.region-stats {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* Region indicator in headers */
.region-indicator {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-left: auto;
    margin-right: 10px;
}
