/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #718096;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #2d3748;
}

.modal-body {
    padding: 1.5rem;
}

/* Form Container */
.form-container {
    background: white;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}

/* Floating Action Button */
.floating-action-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #4a6cf7;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 300;
    transition: all 0.3s ease;
    z-index: 999;
}

.floating-action-btn:hover {
    background-color: #3b5bdb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 108, 247, 0.4);
}

.floating-action-btn svg {
    width: 24px;
    height: 24px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-primary {
    background-color: #4a6cf7;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex: 1;
}

.btn-primary:hover {
    background-color: #3b5bdb;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #2d3748;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex: 1;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Form styles */
.form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    font-weight: 500;
    transition: all 0.3s ease;
    display: block;
    margin: 0.5rem 0;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#test-btn {
    background-color: #4CAF50;
}

#test-btn:hover {
    background-color: #3e8e41;
}

/* Loading spinner */
#loading {
    text-align: center;
    margin: 2rem 0;
    display: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #3498db;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Results Section */
#results {
    margin-top: 2rem;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.summary {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a6cf7;
}

.summary h3 {
    margin-top: 0;
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.summary-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-item .label {
    display: block;
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.summary-item .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
}

/* Competitors table */
.competitors {
    margin-top: 2.5rem;
}

.competitors h4 {
    color: #2d3748;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.competitor-table {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.table-header, .table-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    align-items: center;
}

.table-header {
    background-color: #4a6cf7;
    color: white;
    font-weight: 600;
}

.table-body {
    max-height: 500px;
    overflow-y: auto;
}

.table-row {
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

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

.table-row:hover {
    background-color: #f8fafc;
}

.table-cell {
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    color: #4a5568;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-cell.name {
    font-weight: 500;
    color: #2d3748;
}

.table-cell.rating {
    font-weight: 600;
    color: #2f855a;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 1.5rem;
}

.export-btn:hover {
    background-color: #3b5bdb;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .table-header, .table-row {
        grid-template-columns: 2fr 2fr 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .table-header, .table-row {
        grid-template-columns: 2fr 1.5fr 1fr;
    }
    
    .table-cell.address,
    .table-cell.distance {
        display: none;
    }
}

@media (max-width: 480px) {
    .table-header, .table-row {
        grid-template-columns: 1fr 1fr;
        padding: 0.75rem 1rem;
    }
    
    .table-cell.reviews {
        display: none;
    }
    
    .table-cell {
        font-size: 0.875rem;
    }
}

.competitor-card a {
    color: #3498db;
    text-decoration: none;
}

.competitor-card a:hover {
    text-decoration: underline;
}

.success-message {
    background-color: #e8f5e9;
    border-left: 4px solid #4CAF50;
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 4px;
}

#results h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* No Results Placeholder */
.no-results {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    margin-top: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.no-results:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.no-results-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.no-results-icon {
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.no-results h3 {
    color: #334155;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.no-results p {
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

.plus-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #4a6cf7;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin: 0 4px;
    position: relative;
    top: -1px;
}

/* Error message */
.error {
    background-color: #fde8e8;
    color: #c53030;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    display: none;
}

/* Utility classes */
.hidden {
    display: none;
}

/* Responsive design */
@media (min-width: 768px) {
    .form-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .form-group:last-child {
        grid-column: 1 / -1;
    }
    
    button {
        max-width: 200px;
        margin: 0 auto;
    }
}
