/**
 * 🎨 GLOBAL STYLES
 * Dark theme - n8n formu ile uyumlu tasarım
 */

:root {
    /* 🔠 Tipografi */
    --font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    
    /* 🎨 Renkler - Modern Purple/Blue Theme */
    --bg-dark: #0a0e27;
    --bg-gradient: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1428 100%);
    --bg-card: rgba(30, 35, 62, 0.6);
    --bg-card-hover: rgba(42, 48, 86, 0.8);
    --bg-primary: #1e233e;
    --bg-secondary: #151933;
    --bg-input: rgba(15, 20, 40, 0.8);
    --border-color: rgba(99, 102, 241, 0.2);
    --border-input: rgba(139, 92, 246, 0.3);
    
    --text-white: #f1f5ff;
    --text-gray: #a0aec0;
    --text-muted: #718096;
    
    --primary: #7c3aed;
    --primary-hover: #6366f1;
    --primary-light: #8b5cf6;
    
    --success: #10b981;
    --success-hover: #059669;
    --error: #ef4444;
    --error-hover: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* 🖌️ Gölgeler & Köşeler */
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-focus: 0 0 0 3px rgba(139, 92, 246, 0.25);
    
    /* 📐 Boyutlar */
    --max-width: 1200px;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-white);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

/* 📦 Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
}

.container-sm {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
}

/* 🃏 Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card), 0 0 40px rgba(124, 58, 237, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: var(--shadow-hover), 0 0 60px rgba(124, 58, 237, 0.15);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* 📝 Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: var(--text-white);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-sm);
    color: var(--text-white);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-light);
    background: rgba(15, 20, 40, 0.95);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 4px 20px rgba(124, 58, 237, 0.3);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* 🔘 Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

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

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-white);
    border: 1px solid var(--border-color);
}

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ⚠️ Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(16, 185, 129, 0.6);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--info);
    color: var(--info);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

/* 💳 Credit Badge */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

/* 📊 Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table thead {
    background: var(--bg-dark);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-white);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-gray);
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* 🔄 Loading Spinner */
.spinner {
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

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

.loading-text {
    text-align: center;
    color: var(--text-gray);
    margin-top: 1rem;
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

/* 🎯 Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-column { display: flex; flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none; }

/* 📱 Responsive: Temel mobil iyileştirmeler mobile.css'e taşındı. */

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

/* Better touch targets for mobile */
button, a, input[type="submit"], .btn {
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
}

/* Prevent text selection on buttons */
button, .btn {
    -webkit-user-select: none;
    user-select: none;
}

/* Better focus visibility for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 🎭 Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

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

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

/* 🔗 Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 🖼️ Logo */
.logo {
    max-width: 200px;
    margin: 0 auto 2rem;
    display: block;
}

/* 📋 Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-gray);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

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

.stat-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.3);
}

.stat-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.4));
}

/* 🎉 Yeni Arama Başlat Card */
.action-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(99, 102, 241, 0.15) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.2);
    transition: all 0.3s ease;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 48px rgba(124, 58, 237, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
}

/* 📃 Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* 🎭 Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
    opacity: 0;
}

.modal-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 📊 Modern Data Grid - Professional Table Design */

/* ===== SCROLLBAR ===== */
.data-grid-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.data-grid-wrapper::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.data-grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.data-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ===== TABLE CONTAINER ===== */
.data-grid-wrapper {
    width: 100%;
    overflow: auto;
    max-height: 75vh;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: #1e293b;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ===== TABLE BASE ===== */
.data-grid {
    width: 100%;
    min-width: 1400px; /* Tüm sütünların toplamı - scroll oluştur */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    table-layout: fixed; /* Sabit layout - header'lar tam görünsün */
}

/* ===== HEADER ===== */
.data-grid thead {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.data-grid th {
    padding: 1rem; /* Tüm taraflar eşit - optimize */
    text-align: left;
    font-weight: 600;
    color: #f1f5f9;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(99, 102, 241, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    background: inherit;
    position: relative;
    overflow: hidden;
}

.data-grid th:last-child {
    border-right: none;
}

.data-grid th .th-text {
    display: block;
    white-space: normal; /* Multi-line için */
    line-height: 1.3;
    word-break: break-word;
    padding-right: 18px; /* Sort indicator için minimal yer */
    min-height: 1.3em;
}

/* ===== SORT INDICATOR ===== */
.data-grid th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-grid th.sortable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sort-indicator {
    position: absolute;
    right: 0.5rem; /* Daha yakın */
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    opacity: 0.4;
    font-size: 0.65rem;
    pointer-events: none;
}

.data-grid th.sort-asc .sort-indicator::after {
    content: '▲';
    opacity: 1;
    color: #6366f1;
}

.data-grid th.sort-desc .sort-indicator::after {
    content: '▼';
    opacity: 1;
    color: #6366f1;
}

/* ===== RESIZE HANDLE ===== */
.resize-handle {
    position: absolute;
    right: 0; /* Tam sağ kenarda - border-right üzerinde */
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    background: transparent; /* Varsayılan olarak görünmez */
    transition: background 0.2s ease;
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(99, 102, 241, 0.6);
}

.resize-handle.resizing {
    background: rgba(99, 102, 241, 0.9);
}

/* ===== COLUMN WIDTHS ===== */
.data-grid .col-number { width: 100px; } /* SIRA için daha geniş */
.data-grid .col-name { width: 220px; }
.data-grid .col-phone { width: 150px; }
.data-grid .col-email { width: 180px; }
.data-grid .col-address { width: 280px; }
.data-grid .col-url { width: 160px; }
.data-grid .col-social { width: 120px; }
.data-grid .col-rating { width: 100px; } /* RATİNG için daha geniş */
.data-grid .col-default { width: 140px; }

/* ===== BODY ROWS ===== */
.data-grid tbody tr {
    transition: background 0.15s ease;
    background: #1e293b;
}

.data-grid tbody tr:nth-child(even) {
    background: #192433;
}

.data-grid tbody tr:hover {
    background: #2d3748;
}

/* ===== CELLS ===== */
.data-grid td {
    padding: 0.875rem 1.25rem;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.data-grid td:last-child {
    border-right: none;
}

.data-grid tbody tr:last-child td {
    border-bottom: none;
}

/* Çift tıklama ile genişletilmiş hücre - Excel gibi */
.data-grid td.expanded {
    white-space: normal !important;
    word-wrap: break-word;
    max-width: 500px;
    z-index: 60;
    background: #0f172a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    position: relative;
}

/* Boş hücreler */
.data-grid td:empty::before {
    content: '—';
    color: #64748b;
    opacity: 0.5;
}

@media (min-width: 769px) {
  /* ===== STICKY SECOND COLUMN (İSİM) SADECE MASAÜSTÜNDE ===== */
  .data-grid th:nth-child(2),
  .data-grid td:nth-child(2) {
      position: sticky;
      left: 0;
      z-index: 20;
      box-shadow: 3px 0 8px rgba(0, 0, 0, 0.3);
      border-right: 1px solid rgba(99, 102, 241, 0.2);
  }
  .data-grid thead th:nth-child(2) {
      z-index: 40;
      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  .data-grid tbody tr td:nth-child(2) {
      background: #1e293b;
  }
  .data-grid tbody tr:nth-child(even) td:nth-child(2) {
      background: #192433;
  }
  .data-grid tbody tr:hover td:nth-child(2) {
      background: #2d3748;
  }
}

/* ===== STATES ===== */
.data-grid tbody tr.selected {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid #6366f1;
}

.data-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.data-grid tbody:empty::after {
    content: 'Sonuç bulunamadı';
    display: block;
    text-align: center;
    padding: 3rem;
    color: #64748b;
    font-size: 1.1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .data-grid {
        font-size: 0.85rem;
    }
    
    .data-grid th,
    .data-grid td {
        padding: 0.75rem 1rem;
    }
}
