/* 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-color: #f9f9f9;
}

/* Header Styles */
header {
    background-color: #fff;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Language Switcher Styles */
.language-switcher {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-btn {
    background: none;
    border: 2px solid #ddd;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.lang-btn.active {
    background-color: #3498db;
    border-color: #3498db;
    color: #fff;
}

.lang-separator {
    color: #ddd;
    font-weight: 300;
}

/* Logo Styles */
.logo {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Mobile devices (< 768px) */
@media (max-width: 767px) {
    .logo {
        max-width: 200px;
    }
    
    .language-switcher {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .lang-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Tablet devices (768px-1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .logo {
        max-width: 300px;
    }
}

/* Desktop devices (> 1024px) */
@media (min-width: 1025px) {
    .logo {
        max-width: 400px;
    }
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Services Section */
#services {
    margin-bottom: 3rem;
}

#services h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #1e5a8e; /* Deep blue from professional real estate palette */
    font-weight: 700;
}

/* Services Grid - Mobile First Approach (Requirement 7.1) */
.services-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

/* Service Card Styling (Requirements 2.3, 2.4) */
.service-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Individual service card hover colors */
.service-card-1:hover {
    background-color: #e3f2fd; /* Light blue for Real Estate */
}

.service-card-2:hover {
    background-color: #f3e5f5; /* Light purple for Life Insurance */
}

.service-card-3:hover {
    background-color: #e8f5e9; /* Light green for Income Tax */
}

.service-card-4:hover {
    background-color: #fff3e0; /* Light orange for Notarized Documents */
}

.service-card h3 {
    font-size: 22px; /* Decreased from 24px (1.5rem) by 2px */
    margin-bottom: 0.75rem;
    color: #2a6fa8; /* Medium blue for service card headings */
    font-weight: 600;
}

.service-icon-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.service-icon {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.service-card:hover .service-icon {
    transform: translateY(-4px) scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.service-card p {
    font-size: 14px; /* Decreased from 16px (1rem) by 2px */
    line-height: 1.6;
    color: #555;
}

/* Tablet devices (768px-1024px) - 2 columns (Requirement 2.3) */
@media (min-width: 768px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop devices (> 1024px) - 4 columns (Requirement 2.3) */
@media (min-width: 1025px) {
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Contact Section */
#contact {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#contact h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #1e5a8e; /* Deep blue from professional real estate palette */
    font-weight: 700;
}

/* Contact Form Styles (Requirements 3.1, 7.2, 10.1, 10.2, 10.4) */
#contact-form {
    max-width: 600px;
    margin: 0 auto;
}

#contact-form fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

#contact-form legend {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1e5a8e; /* Deep blue matching main headings */
}

/* Form Group Styling */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

/* Ensure adequate spacing between form groups on mobile (Requirement 7.2) */
@media (max-width: 767px) {
    .form-group {
        margin-bottom: 1.75rem;
    }
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1rem;
    line-height: 1.4;
}

.form-group label .required {
    color: #e74c3c;
    font-weight: 600;
}

/* Form Input Styling (Requirements 7.2, 10.4) */
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px; /* Minimum tap target size for mobile (Requirement 7.2) */
    font-family: inherit;
    line-height: 1.5;
}

/* Increase touch target size on mobile for better usability */
@media (max-width: 767px) {
    .form-group input,
    .form-group select {
        min-height: 48px;
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus) {
    border-color: #bbb;
}

.form-group input.error,
.form-group select.error {
    border-color: #e74c3c;
}

.form-group input.error:focus,
.form-group select.error:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

/* Error Message Styling (Requirement 4.8, 10.3) */
.form-group .error-message {
    display: block;
    color: #c0392b;
    font-size: 0.875rem;
    margin-top: 0.375rem;
    font-weight: 500;
    line-height: 1.4;
}

.form-group .error-message:empty {
    display: none;
}

/* Form Actions */
.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Submit Button Styling (Requirements 7.2, 8.1, 10.4) */
.submit-button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #3498db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    min-height: 44px; /* Minimum tap target size for mobile (Requirement 7.2) */
    min-width: 120px;
    font-family: inherit;
}

/* Optimize button for mobile touch targets */
@media (max-width: 767px) {
    .submit-button {
        min-height: 48px;
        padding: 0.875rem 2rem;
        font-size: 1.0625rem;
    }
}

.submit-button:hover:not(:disabled) {
    background-color: #2980b9;
}

.submit-button:active:not(:disabled) {
    transform: translateY(1px);
}

.submit-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.4);
}

.submit-button:focus:not(:focus-visible) {
    box-shadow: none;
}

.submit-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.4);
}

.submit-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* Loading Indicator (Requirement 8.1) */
.loading-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    color: #3498db;
}

.loading-indicator[aria-hidden="false"] {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 0.875rem;
}

/* Success Message Styling (Requirements 3.3, 5.7, 8.4) */
.success-message {
    display: none;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5;
}

.success-message[aria-hidden="false"] {
    display: block;
    animation: slideIn 0.3s ease-out;
}

/* Global Error Message Styling (Requirements 6.1, 6.2, 8.4) */
.error-message-global {
    display: none;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5;
}

.error-message-global[aria-hidden="false"] {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness for Form */
@media (max-width: 767px) {
    #contact {
        padding: 1.5rem 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .submit-button {
        width: 100%;
    }
}

/* Footer Styles */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
}

footer p {
    font-size: 0.9rem;
}
