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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  margin-bottom: 30px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content > div {
  text-align: left;
}

header h1 {
  margin-bottom: 5px;
}

header p {
  opacity: 0.9;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

section {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h2 {
  margin-bottom: 15px;
  color: #444;
}

.hosts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.hosts-header h2 {
  margin-bottom: 0;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-controls label {
  font-size: 14px;
  color: #666;
}

.sort-controls select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.sort-controls select:hover {
  border-color: #667eea;
}

.form-row {
  display: flex;
  gap: 10px;
}

input[type="text"],
input[type="number"] {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

input[type="text"] {
  flex: 1;
}

input[type="number"] {
  width: 100px;
}

button {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

button:hover {
  background: #5a6fd6;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 10px;
}

.hosts-container {
  display: grid;
  gap: 15px;
}

.host-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  align-items: center;
}

.host-info h3 {
  margin-bottom: 5px;
  color: #333;
}

.host-link {
  color: #667eea;
  text-decoration: none;
}

.host-link:hover {
  text-decoration: underline;
}

.host-info p {
  font-size: 13px;
  color: #666;
  margin-bottom: 3px;
}

.cipher-info {
  font-family: 'Courier New', monospace;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.host-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

.days-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 14px;
  min-width: 120px;
  text-align: center;
}

.days-badge.green {
  background: #d4edda;
  color: #155724;
}

.days-badge.yellow {
  background: #fff3cd;
  color: #856404;
}

.days-badge.red {
  background: #f8d7da;
  color: #721c24;
}

.days-badge.error {
  background: #e2e3e5;
  color: #383d41;
}

.host-actions {
  display: flex;
  gap: 5px;
}

.host-actions button {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-scan {
  background: #28a745;
}

.btn-scan:hover {
  background: #218838;
}

.btn-history {
  background: #17a2b8;
}

.btn-history:hover {
  background: #138496;
}

.btn-delete {
  background: #dc3545;
}

.btn-delete:hover {
  background: #c82333;
}

.loading, .empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

.close-btn:hover {
  color: #333;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.history-table th,
.history-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.history-table th {
  background: #f8f9fa;
  font-weight: 600;
}

.history-table tr:hover {
  background: #f8f9fa;
}

/* Subdomain Modal */
.modal-large {
  max-width: 900px;
}

#subdomain-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-subdomains {
  background: #6f42c1;
}

.btn-subdomains:hover {
  background: #5a32a3;
}

#subdomain-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.subdomain-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
  gap: 10px;
}

.subdomain-item:last-child {
  border-bottom: none;
}

.subdomain-item:hover {
  background: #f8f9fa;
}

.subdomain-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.subdomain-item label {
  flex: 1;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.subdomain-item .status-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.subdomain-item .status-badge.monitored {
  background: #d4edda;
  color: #155724;
}

.subdomain-item .status-badge.new {
  background: #cce5ff;
  color: #004085;
}

#subdomain-count {
  color: #666;
  margin-bottom: 15px;
}

#scan-mode-option {
  margin-bottom: 15px;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 5px;
  border: 1px solid #e9ecef;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.toggle-label span {
  color: #495057;
}

/* Dangling Scan */
.btn-dangling {
  background: #e83e8c;
}

.btn-dangling:hover {
  background: #d63384;
}

.dangling-section {
  border: 2px solid #e83e8c;
}

.dangling-section.hidden {
  display: none;
}

.dangling-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.dangling-header h2 {
  margin-bottom: 0;
}

.dangling-summary-grid {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.summary-item {
  padding: 15px 25px;
  border-radius: 8px;
  text-align: center;
  min-width: 100px;
}

.summary-item .count {
  display: block;
  font-size: 28px;
  font-weight: bold;
}

.summary-item .label {
  font-size: 12px;
  text-transform: uppercase;
}

.summary-item.ok {
  background: #d4edda;
  color: #155724;
}

.summary-item.warning {
  background: #fff3cd;
  color: #856404;
}

.summary-item.dangling {
  background: #f8d7da;
  color: #721c24;
}

.summary-item.vulnerable {
  background: #721c24;
  color: white;
}

.summary-item.unreachable {
  background: #e2e3e5;
  color: #383d41;
}

.dangling-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  border-left: 4px solid #ddd;
}

.dangling-item.status-ok {
  border-left-color: #28a745;
}

.dangling-item.status-warning {
  border-left-color: #ffc107;
}

.dangling-item.status-dangling {
  border-left-color: #dc3545;
  background: #fff5f5;
}

.dangling-item.status-vulnerable {
  border-left-color: #721c24;
  background: #f8d7da;
}

.dangling-item.status-unreachable {
  border-left-color: #6c757d;
  background: #f8f9fa;
}

.dangling-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dangling-info h4 {
  margin: 0;
  font-family: 'Courier New', monospace;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.ok {
  background: #d4edda;
  color: #155724;
}

.status-badge.warning {
  background: #fff3cd;
  color: #856404;
}

.status-badge.dangling {
  background: #f8d7da;
  color: #721c24;
}

.status-badge.vulnerable {
  background: #721c24;
  color: white;
}

.status-badge.unreachable {
  background: #e2e3e5;
  color: #383d41;
}

.dangling-details p {
  margin: 5px 0;
  font-size: 13px;
  color: #555;
}

.dangling-details .issues {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.dangling-details .issue {
  padding: 5px 10px;
  border-radius: 4px;
  margin: 5px 0;
}

.dangling-details .issue.severity-critical {
  background: #721c24;
  color: white;
}

.dangling-details .issue.severity-high {
  background: #f8d7da;
  color: #721c24;
}

.dangling-details .issue.severity-medium {
  background: #fff3cd;
  color: #856404;
}

.dangling-details .issue.severity-low {
  background: #e2e3e5;
  color: #383d41;
}

/* Dangling Select Modal */
#dangling-select-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

#dangling-select-count {
  color: #666;
  margin-bottom: 15px;
}

#dangling-select-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.dangling-select-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
  gap: 10px;
}

.dangling-select-item:last-child {
  border-bottom: none;
}

.dangling-select-item:hover {
  background: #f8f9fa;
}

.dangling-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.dangling-select-item label {
  flex: 1;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.days-badge-small {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.days-badge-small.green {
  background: #d4edda;
  color: #155724;
}

.days-badge-small.yellow {
  background: #fff3cd;
  color: #856404;
}

.days-badge-small.red {
  background: #f8d7da;
  color: #721c24;
}

.days-badge-small.error {
  background: #e2e3e5;
  color: #383d41;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }

  input[type="number"] {
    width: 100%;
  }

  .host-card {
    grid-template-columns: 1fr;
  }

  .host-status {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
  }
}
