/* ========================================
   LocalSpotFinder - Main Stylesheet
   Professional, SEO-optimized, AdSense-ready
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    
    --text-dark: #1e293b;
    --text-medium: #475569;
    --text-light: #94a3b8;
    
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --transition: 150ms ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* Navigation */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.logo svg {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

.nav-link.btn-primary:hover {
    background: var(--primary-dark);
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    transition: transform 0.3s, opacity 0.3s;
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s, opacity 0.3s;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    
    .mobile-toggle {
        display: flex;
    }
}

/* Search Section */
.search-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 3rem 0;
}

.search-title {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.search-subtitle {
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 2rem;
}

.search-box {
    max-width: 800px;
    margin: 0 auto;
}

.search-inputs {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0 0.75rem;
}

.input-group svg {
    color: var(--text-light);
    flex-shrink: 0;
}

.input-group input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0.75rem 0;
    min-width: 0;
}

.location-group {
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
}

@media (max-width: 640px) {
    .search-inputs {
        flex-direction: column;
    }
    
    .location-group {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0.75rem;
        padding-top: 0.5rem;
    }
}

/* Main Content Layout */
.main-content {
    padding: 2rem 0;
}

.layout-with-sidebar {
    display: grid;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr 300px;
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.widget {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.widget h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.category-list,
.location-list {
    list-style: none;
}

.category-list li,
.location-list li {
    margin-bottom: 0.5rem;
}

.category-list a,
.location-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-medium);
    font-size: 0.875rem;
    padding: 0.5rem 0;
    transition: color var(--transition);
}

.category-list a:hover,
.location-list a:hover {
    color: var(--primary);
}

.category-list .count,
.location-list .count {
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Ad Containers */
.ad-container {
    text-align: center;
    margin: 1rem 0;
}

.ad-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
}

.ad-sidebar {
    margin: 0;
}

.ad-in-content {
    margin: 2rem 0;
}

.ad-footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
}

/* Business Cards */
.business-grid {
    display: grid;
    gap: 1rem;
}

.business-card {
    display: flex;
    gap: 1rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}

.business-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.business-image {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.business-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.rating-badge svg {
    color: #f59e0b;
}

.business-content {
    flex: 1;
    min-width: 0;
}

.business-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.business-name {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
}

.business-name a {
    color: var(--text-dark);
}

.business-name a:hover {
    color: var(--primary);
}

.category-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    white-space: nowrap;
    flex-shrink: 0;
}

.business-types {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.business-location,
.business-phone,
.business-website {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.business-location svg,
.business-phone svg,
.business-website svg {
    color: var(--text-light);
    flex-shrink: 0;
}

.business-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.review-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.btn-view {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-view:hover svg {
    transform: translateX(2px);
}

.btn-view svg {
    transition: transform var(--transition);
}

@media (max-width: 640px) {
    .business-card {
        flex-direction: column;
    }
    
    .business-image {
        width: 100%;
        height: 180px;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.pagination a {
    background: var(--bg-white);
    color: var(--text-medium);
    box-shadow: var(--shadow);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
}

.pagination .current {
    background: var(--primary);
    color: white;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.footer-brand .logo {
    color: white;
    margin-bottom: 1rem;
}

.footer-desc {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-links h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: white;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.875rem;
}

.newsletter-form input::placeholder {
    color: rgba(255,255,255,0.5);
}

.newsletter-form button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Page Title Section */
.page-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-medium);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--text-medium);
}

.breadcrumbs .separator {
    color: var(--text-light);
}

.breadcrumbs .current {
    color: var(--text-light);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}

.category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.category-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.category-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.category-card p {
    font-size: 0.875rem;
    color: var(--text-medium);
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

/* Touch-friendly buttons (min 44px) */
@media (pointer: coarse) {
    button,
    .btn,
    a.nav-link,
    .business-card,
    .category-card,
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger touch targets */
    .business-phone a,
    .business-website a,
    .btn-view {
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch */
    .business-card:hover,
    .category-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
}

/* Mobile Typography */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }
    
    h1, .page-title {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .search-title {
        font-size: 1.75rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
}

/* Safe Area Support (Notch) */
@supports (padding-top: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile Layout Improvements */
@media (max-width: 768px) {
    /* Stack business cards vertically */
    .business-card {
        flex-direction: column;
    }
    
    .business-image {
        width: 100%;
        height: 180px;
    }
    
    /* Full width buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Compact search */
    .search-form {
        flex-direction: column;
    }
    
    .search-form input,
    .search-form button {
        width: 100%;
    }
    
    /* Adjust grid */
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .business-grid {
        grid-template-columns: 1fr;
    }
    
    /* Hide sidebar on mobile */
    .layout-with-sidebar .sidebar {
        display: none;
    }
    
    .layout-with-sidebar .content-area {
        width: 100%;
    }
}

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(
        90deg,
        #f1f5f9 25%,
        #e2e8f0 50%,
        #f1f5f9 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-image {
    height: 120px;
    width: 100%;
}

/* Pull to Refresh Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.pull-spinner.spinning::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Mobile Business Detail */
@media (max-width: 768px) {
    .business-detail {
        padding: 1rem;
    }
    
    .business-detail .action-buttons {
        flex-direction: column;
    }
    
    .business-detail .action-buttons a {
        width: 100%;
        justify-content: center;
    }
}

/* Admin Styles */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.admin-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.admin-card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.admin-card-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-medium);
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-medium);
    background: var(--bg-light);
}

.admin-table tr:hover {
    background: var(--bg-light);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

/* Print Styles */
@media print {
    .navbar,
    .search-section,
    .sidebar,
    .footer,
    .ad-container {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
}
