/* Import Inter font (Stripe's font) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 1.85rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    min-height: 600px;
    align-items: start;
}

/* Sidebar */
.sidebar {
    background: #f8f9fa;
    padding: 30px 25px;
    border-right: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar h3 {
    color: #333;
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar p {
    margin-bottom: 12px;
    color: #555;
    line-height: 1.7;
    font-weight: 400;
}

.sidebar ul {
    margin: 15px 0 25px 20px;
    color: #555;
}

.sidebar li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.sidebar li strong {
    color: #667eea;
}

/* About Section */
.about-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

/* Feedback Section */
.feedback-section {
    margin-top: 20px;
}

.feedback-form {
    margin-top: 15px;
}

.feedback-form .submit-btn {
    margin-top: 5px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-family: 'Inter', inherit;
    font-size: 0.875rem;
    font-weight: 400;
    transition: all 0.2s ease;
}

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

/* Consistent placeholder styling */
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
    font-family: 'Inter', inherit;
    font-size: 0.875rem;
    font-weight: 400;
    opacity: 1;
}

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

.submit-btn {
    width: 100%;
    padding: 11px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.submit-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-success {
    margin-top: 20px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
}

.feedback-success.hidden {
    display: none;
}

/* Main Column */
.main-column {
    display: flex;
    flex-direction: column;
}

/* Search Section */
.search-section {
    padding: 40px 30px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    z-index: 100;
}

.search-section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.search-box {
    position: relative;
}

.search-box {
    display: flex;
    gap: 10px;
}

#postcode-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
    font-weight: 400;
}

#postcode-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#search-btn {
    padding: 15px 30px;
    font-size: 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    letter-spacing: -0.01em;
}

#search-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.search-hint {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.15rem;
    line-height: 1.6;
    font-weight: 600;
}

/* Autocomplete */
.autocomplete-items {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    width: 100%;
    top: 100%;
    left: 0;
}

.autocomplete-items.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* Results Container */
.results-container {
    padding: 30px;
}

.results-container.hidden {
    display: none;
}

/* Map Section */
.map-section {
    padding: 30px;
    background: white;
    position: relative;
    z-index: 1;
}

#map {
    width: 100%;
    height: 320px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Info Section */
.info-section {
    margin-bottom: 30px;
}

.info-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.info-card h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.info-item {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.info-item strong {
    color: #555;
}

/* Postcodes Section */
.postcodes-section {
    margin-bottom: 30px;
}

.postcodes-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.postcodes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.postcodes-header h2 {
    color: #667eea;
}

.export-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.export-btn:hover {
    background: #218838;
}

.postcodes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.postcode-item {
    padding: 10px;
    background: white;
    border-radius: 6px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.pagination.hidden {
    display: none;
}

.pagination button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #5568d3;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#page-info {
    font-weight: 600;
    color: #555;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

.error-message.hidden {
    display: none;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.footer-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.footer-content a {
    color: #667eea;
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

.attribution {
    margin-top: 15px;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }

    .search-box {
        flex-direction: column;
    }

    #map {
        height: 300px;
    }

    .postcodes-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .postcodes-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sidebar {
        padding: 20px;
    }
    
    .results-container {
        padding: 20px;
    }
    
    .search-section {
        padding: 30px 20px;
    }
    
    .search-hint {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .map-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }

    .postcodes-list {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}
