/* Root Variables */
:root {
    --dark-blue: #0A1628;
    --medium-blue: #1a2942;
    --light-blue: #2a3f5f;
    --orange: #FF6B35;
    --orange-hover: #e55a28;
    --whitesmoke: #F5F5F5;
}

/* 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;
    background-color: var(--dark-blue);
    color: var(--whitesmoke);
    line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-blue);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--orange);
    border-radius: 10px;
    border: 2px solid var(--dark-blue);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--orange-hover);
}

/* Animations */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Business Card Styles */
.business-card {
    background: var(--medium-blue);
    border: 2px solid var(--light-blue);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.business-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--orange), var(--orange-hover));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.business-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(255, 107, 53, 0.2);
    border-color: var(--orange);
}

.business-card:hover::before {
    transform: scaleX(1);
}

/* Map Container */
#map {
    z-index: 1;
    border-radius: 1rem;
}

.leaflet-popup-content-wrapper {
    background: var(--medium-blue) !important;
    color: var(--whitesmoke) !important;
    border: 2px solid var(--orange);
    border-radius: 0.5rem;
}

.leaflet-popup-tip {
    background: var(--medium-blue) !important;
}

/* AI Assistant */
#aiAssistant {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#aiAssistant.minimized {
    transform: translateY(calc(100% - 60px));
}

#aiAssistant.minimized #chatMessages,
#aiAssistant.minimized .border-t-2 {
    display: none;
}

#chatMessages {
    scrollbar-width: thin;
    scrollbar-color: var(--orange) var(--dark-blue);
}

#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: var(--dark-blue);
}

#chatMessages::-webkit-scrollbar-thumb {
    background: var(--orange);
    border-radius: 3px;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--light-blue);
    border-radius: 50%;
    border-top: 4px solid var(--orange);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Demand Level Badges */
.demand-low {
    background: linear-gradient(135deg, #10B981, #059669);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.demand-medium {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
}

.demand-high {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
}

/* Button Styles */
button, .btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

button:active, .btn:active {
    transform: scale(0.98);
}

/* Input Focus Styles */
input:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

/* Card Hover Effect for Results */
.business-card .copy-email,
.business-card .copy-sms {
    opacity: 0.9;
    transition: all 0.2s ease;
}

.business-card .copy-email:hover,
.business-card .copy-sms:hover {
    opacity: 1;
    transform: translateX(2px);
}

/* Header Shadow */
header {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Link Styles */
a {
    transition: all 0.2s ease;
}

/* Toast Notification */
.toast {
    animation: slideInRight 0.3s ease-out;
}

/* Gradient Background for Hero */
.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--medium-blue), var(--dark-blue));
}

/* Social Icons */
.social-icon {
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-icon:hover {
    transform: translateY(-2px);
    color: var(--orange) !important;
}

/* Results Count Badge */
#resultsCount {
    background: var(--light-blue);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 1280px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 1024px) {
    #aiAssistant {
        width: 85%;
        right: 7.5%;
    }
}

@media (max-width: 768px) {
    #aiAssistant {
        width: 90%;
        right: 5%;
        bottom: 1rem;
    }

    .business-card {
        padding: 1rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 640px) {
    header .container {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    nav {
        flex-direction: column;
        width: 100%;
    }

    nav a, nav button {
        width: 100%;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--medium-blue) 25%, var(--light-blue) 50%, var(--medium-blue) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state svg {
    opacity: 0.5;
}

/* Contact Info Display */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Rating Stars */
.rating-stars {
    color: #FFD700;
    display: inline-flex;
    align-items: center;
}

/* Map Legend */
.map-legend {
    font-size: 0.875rem;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Business Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--light-blue);
    color: var(--whitesmoke);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Sticky Positioning for Map */
.sticky {
    position: sticky;
    top: 6rem;
}

/* Form Elements */
form label {
    font-weight: 500;
}

form input::placeholder {
    color: #9CA3AF;
}

/* Card Grid Layout */
.card-grid {
    display: grid;
    gap: 1.5rem;
}

/* Success State */
.success-message {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
}

/* Error State */
.error-message {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
}

/* Copy Button Animation */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.copy-success {
    animation: copySuccess 0.3s ease;
}

/* Footer Links */
footer a {
    color: var(--whitesmoke);
    text-decoration: none;
}

footer a:hover {
    color: var(--orange);
}

/* Dropdown Menu (if needed) */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--medium-blue);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    border: 2px solid var(--light-blue);
    z-index: 1;
    margin-top: 0.5rem;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--whitesmoke);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
}

.dropdown-content a:hover {
    background-color: var(--light-blue);
    color: var(--orange);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Search Form Enhancement */
#searchForm input:focus {
    transform: translateY(-2px);
}

/* Business Card Content Sections */
.business-card-section {
    padding: 1rem 0;
    border-top: 1px solid var(--light-blue);
    margin-top: 1rem;
}

.business-card-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Icon Containers */
.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--orange);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.icon-container:hover {
    transform: rotate(5deg) scale(1.05);
}

/* Text Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--orange), var(--orange-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Z-Index Management */
.z-highest {
    z-index: 9999;
}

/* Print Styles */
@media print {
    header, footer, #aiAssistant {
        display: none;
    }
    
    .business-card {
        page-break-inside: avoid;
        border: 1px solid #000;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background-color: var(--orange);
    color: white;
}

::-moz-selection {
    background-color: var(--orange);
    color: white;
}