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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f1d4 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: #000;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    color: #000;
}

/* Search section */
.search-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.search-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.search-group label {
    font-weight: 600;
    color: #555;
    font-size: 1.1rem;
    text-align: center;
}

.search-group input {
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.search-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Upload section */
.upload-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-upload {
    border: 3px dashed #e1e5e9;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: #fafbfc;
}

.file-upload:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.1);
}

.file-upload.drag-over {
    border-color: #4CAF50;
    background: #f1f8e9;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.2);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.upload-icon {
    font-size: 3rem;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.file-upload:hover .upload-icon {
    opacity: 1;
    transform: scale(1.1);
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.upload-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.upload-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.upload-btn {
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
}

.upload-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.file-info {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.btn-secondary {
    background: #2196F3;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-download {
    background: #FF9800;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-download:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-map {
    background: #9C27B0;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-map:hover {
    background: #7B1FA2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Add Property Section */
.add-property-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 40px;
    margin-bottom: 25px;
}

.add-property-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.property-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.btn-add {
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
    align-self: flex-start;
}

.btn-add:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Filters */
.filters {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.view-btn {
    background: #f8f9fa;
    color: #666;
    padding: 10px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.view-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.view-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Properties container */
.properties-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Map container */
.map-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

/* QR Code section */
.qr-code-section {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#qrCodeCanvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Amenities checkboxes */
.amenities-checkboxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    position: relative;
    padding-left: 30px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-label:hover input ~ .checkmark {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.checkbox-label input:checked ~ .checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f1d4 100%);
    color: #333;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: #333;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-primary {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Property details grid */
.property-details {
    display: grid;
    gap: 20px;
}

.detail-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.detail-section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: #333;
    font-size: 1rem;
    word-break: break-word;
}

.coordinates {
    background: #e3f2fd;
    border-left-color: #2196F3;
}

.amenities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.amenity-item {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}

.properties-table {
    width: 100%;
    border-collapse: collapse;
}

.properties-table th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e1e5e9;
    font-size: 0.9rem;
}

.properties-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: top;
}

.properties-table tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

.property-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.property-type {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.property-location {
    color: #666;
    font-size: 0.85rem;
    margin-top: 4px;
}

.property-price {
    color: #2e7d32;
    font-size: 0.9rem;
    font-weight: 600;
}

.property-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.amenity-tag {
    background: #f0f2f5;
    color: #666;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    border: 1px solid #e1e5e9;
}

.property-url {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2196F3;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.property-url:hover {
    color: #1976D2;
}

.property-actions {
    text-align: center;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.btn-details {
    background: #17a2b8;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-details:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.btn-coordinates {
    background: #17a2b8;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    width: 100%;
}

.btn-coordinates:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Coordinate picker modal */
.coordinate-modal {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    height: 90vh;
}

.coordinate-instructions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #17a2b8;
}

.coordinate-instructions p {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 500;
}

.coordinate-display {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.coord-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.coord-item label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.coord-item span {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #e1e5e9;
    font-family: monospace;
    font-size: 0.9rem;
    color: #333;
    min-width: 120px;
}

#coordinateMap {
    border: 2px solid #e1e5e9;
    margin-top: 10px;
}

.coordinate-modal .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#useCoordsBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
}

.no-data p {
    font-size: 1.1rem;
    color: #666;
}

/* Mobile note - hidden by default, shown on mobile */
.mobile-add-property-note {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-section {
        flex-direction: column;
        text-align: center;
    }
    
    .search-group {
        max-width: 100%;
    }
    
    .search-group input {
        font-size: 1rem;
        padding: 12px 15px;
    }
    
    .amenities-checkboxes {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters {
        grid-template-columns: 1fr;
    }
    
    .properties-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        position: relative;
    }
    
    .properties-container::after {
        content: "← Swipe to see more →";
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0,0,0,0.7);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.7rem;
        z-index: 10;
        pointer-events: none;
    }
    
    .properties-table {
        font-size: 0.8rem;
        min-width: 800px; /* Ensure table doesn't compress too much */
    }
    
    .properties-table th,
    .properties-table td {
        padding: 8px 6px;
        white-space: nowrap; /* Prevent text wrapping in cells */
    }
    
    .property-actions {
        display: flex;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .btn-details,
    .property-url {
        padding: 6px 10px;
        font-size: 0.75rem;
        min-width: 60px;
        text-align: center;
    }
    
    .property-amenities {
        display: none;
    }
    
    .add-property-section {
        display: none;
    }
    
    .mobile-add-property-note {
        display: block;
        background: #e3f2fd;
        border: 1px solid #2196f3;
        border-radius: 8px;
        padding: 15px;
        margin: 20px 0;
        text-align: center;
        color: #1976d2;
        font-size: 0.9rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error messages */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* URL loader modal */
.url-instructions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.url-examples {
    margin-top: 15px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
}

.url-examples ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.url-examples code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #d63384;
}
