/* DijigoMap SaaS Design System v3.0 - Premium B2B Look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Premium SaaS Color Palette */
    --primary: #3b82f6;       /* Soft Blue 500 */
    --primary-hover: #2563eb; /* Blue 600 */
    --primary-light: #eff6ff; /* Blue 50 */
    
    --secondary: #64748b;     /* Slate 500 */
    --accent: #0ea5e9;        /* Sky 500 */
    
    --bg-body: #f9fafb;       /* Cool Gray 50 (Lighter, Modern) */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #111827;     /* Gray 900 */
    --text-muted: #6b7280;    /* Gray 500 */
    --text-light: #9ca3af;    /* Gray 400 */
    
    --border: #e5e7eb;        /* Gray 200 */
    --border-light: #f3f4f6;  /* Gray 100 */
    
    /* Soft Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Subtle Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
    
    /* Status Colors */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;
}

/* === DARK MODE CONFIGURATION === */
html.dark {
    /* Backgrounds */
    --bg-body: #0f172a;       /* Slate 900 */
    --bg-card: #1e293b;       /* Slate 800 */
    --bg-sidebar: #1e293b;    /* Slate 800 */
    
    /* Text Colors */
    --text-main: #f1f5f9;     /* Slate 100 */
    --text-muted: #94a3b8;    /* Slate 400 */
    --text-light: #64748b;    /* Slate 500 */
    
    /* Borders */
    --border: #334155;        /* Slate 700 */
    --border-light: #1e293b;  /* Slate 800 */
    
    /* Primary Color Adjustments for Dark Mode */
    --primary-light: rgba(59, 130, 246, 0.1); /* Darker Blue 50 equivalent */
}

/* Dark Mode Specific Overrides */
html.dark .search-input {
    background: #1e293b; /* Match card bg */
    border-color: #334155;
    color: #f1f5f9;
}

html.dark .search-input:focus {
    background: #0f172a; /* Darker on focus */
    border-color: var(--primary);
}

html.dark .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

html.dark .sidebar-footer a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Ensure images/logos don't look too bright in dark mode if needed */
/* html.dark img { opacity: 0.9; } */

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

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

body {
    background-color: var(--bg-body);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px; /* Slightly larger base for readability */
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* overflow: hidden; Removed to allow native scrolling */
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }

/* === APP LAYOUT SYSTEM === */
.app-layout {
    min-height: 100vh;
    width: 100vw;
    background-color: var(--bg-body);
}

/* Sidebar is now handled by Tailwind (fixed w-64) in header.php */
/* We keep these for legacy reference or if we revert, but main layout depends on Tailwind classes now */
/* 
.sidebar { ... } 
*/

/* Sidebar fallback — Tailwind CDN yüklenemese bile sidebar doğru konumlanır */
#app-sidebar {
    transform: translateX(-100%);
    pointer-events: none;
}

@media (min-width: 768px) {
    #app-sidebar {
        transform: translateX(0) !important;
        pointer-events: auto;
    }
}

/* Overlay — gizliyken tıklamaları geçir */
#sidebar-overlay {
    pointer-events: none;
}
#sidebar-overlay:not(.hidden) {
    pointer-events: auto;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .main-wrapper {
        margin-left: 16rem;
        width: calc(100% - 16rem);
    }
}

/* Top Header */
.top-header {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%; /* Ensure it fills the wrapper */
}

@media (min-width: 768px) {
    .top-header {
        padding: 0 24px;
    }
}

.header-search {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 99px;
    border: 1px solid var(--border-light);
    background: var(--bg-body);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 18px;
    height: 18px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

/* Content Area */
.content-area {
    flex: 1;
    /* overflow-y: auto; Removed to allow native scrolling */
    padding: 20px;
    background-color: var(--bg-body); /* Ensure background is set */
}

/* Page Container Override for new layout */
.page-container {
    width: 100%;
    max-width: 1400px; /* Wider for dashboard view */
    margin: 0 auto;
    padding: 0 24px; /* Added padding for mobile edges */
}

/* === CUSTOM SCROLLBAR (Chrome/Safari) === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === UTILITIES FOR NON-TAILWIND FALLBACK === */
.blur-xs { filter: blur(2px); -webkit-filter: blur(2px); }
.blur-sm { filter: blur(4px); -webkit-filter: blur(4px); }
.blur-md { filter: blur(8px); -webkit-filter: blur(8px); }
.select-none { user-select: none; -webkit-user-select: none; }

/* Background Utilities */
.bg-gray-50 { background-color: #f9fafb; }
.bg-white { background-color: #ffffff; }

/* Text Utilities */
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }

/* Common Components (Matches Tailwind) */
.rounded-xl { border-radius: 0.75rem; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.border { border-width: 1px; }
.border-gray-200 { border-color: #e5e7eb; }

/* === HOMEPAGE / DASHBOARD STYLES === */

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

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-icon.pink { background: #fdf2f8; color: #ec4899; }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
    gap: 12px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-excel { background: #10b981; color: white; }
.btn-excel:hover { background: #059669; }

.btn-csv { background: #0d9488; color: white; }
.btn-csv:hover { background: #0f766e; }

/* Modern Table */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th {
    background: var(--bg-body);
    text-align: left;
    padding: 12px 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.modern-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 0.9rem;
    vertical-align: middle;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table tr:hover td {
    background: var(--bg-body);
}

/* Table Badges & Status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-gray { background: var(--border-light); color: var(--text-muted); }

.contact-icons {
    display: flex;
    gap: 8px;
}

.icon-box {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    color: var(--text-light);
}

.icon-box.active {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border);
}

/* === FILTER ENGINE STYLES === */
.filter-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.2s;
    height: 42px; /* Fixed height for alignment */
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-filter {
    height: 42px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
}

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

.filter-options {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === TABLE LISTING STYLES === */

.tbl-business-name {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

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

.tbl-business-url {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tbl-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-body);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tbl-icon-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tbl-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-light);
    background: var(--bg-body);
    transition: all 0.2s;
}

.tbl-icon.active {
    background: var(--primary-light);
    color: var(--primary);
}

.tbl-icon.active.phone { background: #e0e7ff; color: #4338ca; }
.tbl-icon.active.map { background: #fef3c7; color: #d97706; }
.tbl-icon.active.web { background: #dbeafe; color: #2563eb; }
.tbl-icon.active.email { background: #fee2e2; color: #dc2626; }
.tbl-icon.active.insta { background: #fce7f3; color: #db2777; }

.tbl-seo-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
}

.tbl-seo-score {
    font-weight: 700;
    font-size: 0.85rem;
}

.tbl-progress-track {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 99px;
    overflow: hidden;
}

.tbl-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

.btn-action-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-action-view:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.tbl-empty-state {
    text-align: center;
    padding: 48px !important;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    padding-bottom: 32px;
}

.pagination-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

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

.pagination-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-link.disabled {
    border: none;
    background: transparent;
}

/* === FOOTER STYLES === */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-top: 64px;
    padding-bottom: 32px;
    margin-top: auto; /* Push to bottom if flex container */
}

.site-footer .footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

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

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

.footer-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: 16px;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contact li {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    align-items: flex-start;
}

.contact-icon {
    color: var(--primary);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.social-links {
    display: flex;
    gap: 8px;
}

.social-links .btn-icon {
    background: var(--bg-body);
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.social-links .btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.footer-bottom {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-legal {
    display: flex;
    gap: 24px;
}

.footer-legal a {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-legal a:hover {
    color: var(--primary);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === LEGACY / CRAWLER SUPPORT === */
/* These classes are added to support crawler.php which uses different class names */

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.text-main { color: var(--text-main); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.2s;
    height: 42px;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    gap: 8px;
}

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

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

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-body);
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
}

.modern-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* === DATASET PAGE STYLES === */
.dataset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.dataset-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

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

.dataset-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.dataset-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dataset-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.4;
}

.dataset-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.dataset-price {
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.85rem;
}

.dataset-features {
    margin-bottom: 20px;
    flex: 1;
}

.dataset-features li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.dataset-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.btn-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    margin-top: auto;
    text-decoration: none;
}

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

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .dataset-grid {
        grid-template-columns: 1fr;
    }
}
