/* MODERN PROFESSIONAL DESIGN v2.0 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fa;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  color: #1a1a1a;
}

/* HEADER - Sticky Top Bar */
.header {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

/* CONTAINER */
.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* CARDS */
.search-card,
.add-query-card,
.queries-section {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 25px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

/* FORM */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  font-size: 13px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
.input-modern {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
  background: white;
}

input[type="text"]:focus,
.input-modern:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* BUTTONS */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary:hover {
  background: #45a049;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.25);
}

.btn-secondary {
  background: #2196F3;
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #1976D2;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.btn-batch {
  background: white;
  color: #4CAF50;
  border: 2px solid #4CAF50;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-batch:hover {
  background: #4CAF50;
  color: white;
  transform: translateY(-1px);
}

/* LOADING */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e0e0e0;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* SITES LIST */
.sites-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.site-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 18px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s;
}

.site-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.site-item.target-site {
  background: #f0fdf4;
  border: 2px solid #4CAF50;
  position: relative;
  padding-left: 24px;
}

.site-item.target-site::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #4CAF50;
  border-radius: 8px 0 0 8px;
}

.site-position {
  font-weight: 700;
  font-size: 20px;
  color: #666;
  min-width: 35px;
  text-align: center;
}

.site-item.target-site .site-position {
  color: #2E7D32;
  font-size: 24px;
}

.site-info {
  flex: 1;
  min-width: 0;
}

.site-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-item.target-site .site-title {
  color: #1B5E20;
  font-weight: 700;
}

.site-link {
  font-size: 13px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ADD QUERY FORM */
.add-query-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 15px;
}

/* QUERIES GRID */
.queries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.static-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s;
}

.static-item:hover {
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.static-keyword {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.static-site {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  word-break: break-all;
}

.site-url {
  cursor: pointer;
  transition: color 0.2s;
}

.site-url:hover {
  color: #4CAF50;
  text-decoration: underline;
}

.static-meta {
  padding-top: 15px;
  border-top: 2px solid #dee2e6;
  margin-bottom: 15px;
}

.static-time {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}

.static-position {
  font-size: 15px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
}

.static-position.success {
  background: #dcfce7;
  color: #16a34a;
}

.static-position.error {
  background: #fee2e2;
  color: #dc2626;
}

.static-buttons {
  display: flex;
  gap: 10px;
}

.btn-small {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.requery-btn {
  background: #2196F3;
  color: white;
}

.requery-btn:hover {
  background: #1976D2;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* BATCH RESULTS */
.batch-progress {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.batch-progress-bar {
  height: 8px;
  background: #4CAF50;
  border-radius: 4px;
  transition: width 0.3s;
  margin-bottom: 10px;
}

.batch-progress-text {
  text-align: center;
  font-weight: 600;
  color: #666;
}

.batch-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.batch-result-item:hover {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.batch-result-item.success {
  border-left: 4px solid #4CAF50;
}

.batch-result-item.error {
  border-left: 4px solid #ef4444;
}

.batch-result-info strong {
  display: block;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.batch-result-info small {
  display: block;
  font-size: 13px;
  color: #666;
}

.batch-result-position {
  font-weight: 700;
  font-size: 20px;
}

.batch-result-item.success .batch-result-position {
  color: #4CAF50;
}

.batch-result-item.error .batch-result-position {
  color: #F44336;
}

.batch-complete-message {
  text-align: center;
  padding: 16px;
  background: #dcfce7;
  color: #166534;
  border-radius: 8px;
  font-weight: 600;
  margin-top: 20px;
  border: 1px solid #bbf7d0;
}

.reload-icon {
  cursor: pointer;
  margin-left: 8px;
  font-size: 20px;
  transition: transform 0.3s;
}

.reload-icon:hover {
  transform: rotate(180deg);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 14px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: #4CAF50;
}

.toast.error {
  background: #ef4444;
}

.toast.info {
  background: #2196F3;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* RESULTS */
.result {
  margin-top: 20px;
  padding: 14px;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.result.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.result.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
    margin: 20px auto;
  }

  .search-card,
  .add-query-card,
  .queries-section {
    padding: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .add-query-form {
    grid-template-columns: 1fr;
  }

  .queries-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-batch {
    width: 100%;
  }
}
