:root {
  --primary-orange: #ED7830;
  --primary-orange-hover: #d66825;
  --primary-orange-light: #f5931f;
  --bg-light: #f8f9fa;
  --text-dark: #333;
  --text-light: #666;
  --border-color: #e0e0e0;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  position: relative;
  overflow: hidden;
}


.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 2;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo h1 {
  color: var(--primary-orange);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.logo p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #fcc;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

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

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary-orange);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

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

.dashboard-container {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--primary-orange);
  color: white;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.sidebar-nav {
  padding: 20px 0;
}

.nav-item {
  display: block;
  padding: 12px 20px;
  color: var(--text-dark);
  text-decoration: none;
  transition: background-color 0.3s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: #f8f9fa;
  border-left-color: var(--primary-orange);
  color: var(--primary-orange);
}

.nav-item i {
  margin-right: 10px;
  width: 16px;
  font-style: normal;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: white;
  padding: 15px 25px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.user-info {
  color: var(--text-light);
  font-size: 0.9rem;
}

.content-area {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card h3 {
  color: var(--primary-orange);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-orange);
  display: block;
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Common Table Styles */
.proxy-table, .rules-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  table-layout: fixed;
}

.proxy-table th,
.proxy-table td,
.rules-table th,
.rules-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-table th,
.rules-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--text-dark);
}

.proxy-table tr:hover,
.rules-table tr:hover {
  background-color: #f8f9fa;
}

/* Proxy Table Column Widths */
.proxy-table th:nth-child(1) { width: 25%; } /* Proxy Name */
.proxy-table th:nth-child(2) { width: 12%; } /* Protocol Type */
.proxy-table th:nth-child(3) { width: 10%; } /* Location */
.proxy-table th:nth-child(4) { width: 10%; } /* Delay (Ping) */
.proxy-table th:nth-child(5) { width: 10%; } /* Delay (Outbound) */
.proxy-table th:nth-child(6) { width: 10%; } /* UDP Test */
.proxy-table th:nth-child(7) { width: 10%; } /* Detail */

/* Rules Table Column Widths */
.rules-table th:nth-child(1) { width: 60%; } /* Ruleset Name */
.rules-table th:nth-child(2) { width: 20%; } /* Counts */
.rules-table th:nth-child(3) { width: 20%; } /* Action */

/* Status Colors */
.delay-good {
  color: #28a745;
  font-weight: 500;
}

.delay-warning {
  color: #ffc107;
  font-weight: 500;
}

.delay-error {
  color: #dc3545;
  font-weight: 500;
}

.status-success {
  color: #28a745;
  font-weight: bold;
}

.status-fail {
  color: #dc3545;
  font-weight: bold;
}

/* Detail Button */
.btn-detail {
  background: var(--primary-orange);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s ease;
}

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

/* Remove Button */
.btn-remove {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s ease;
}

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

/* Copy Button */
.btn-copy {
  background: var(--primary-orange);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

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

.copy-success {
  background: #28a745 !important;
}

/* Provider/Subscription Common Styles */
.subscription-group, .ruleset-group {
  margin-bottom: 20px;
}

.subscription-header, .ruleset-header {
  padding: 10px;
  background: #f8f9fa;
  border-radius: 5px;
  margin-bottom: 10px;
}

.subscription-header-main, .ruleset-header-main {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.subscription-name, .ruleset-name {
  margin-left: 10px;
  font-weight: 500;
  cursor: pointer;
}

.proxy-count, .ruleset-stats {
  margin-left: auto;
  color: #666;
  font-size: 0.9rem;
}

.subscription-url-section, .ruleset-url-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 24px;
  max-width: calc(70vw);
}

.subscription-url, .ruleset-url {
  font-size: 0.85rem;
  color: #666;
  font-family: monospace;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Subscription Toggle */
.toggle-icon, .ruleset-toggle-icon {
  font-size: 14px;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.subscription-header:hover, .ruleset-header:hover {
  background: #e9ecef !important;
}

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: var(--primary-orange);
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #999;
}

.close:hover {
  color: var(--primary-orange);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  margin: 10px 0;
  line-height: 1.6;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Secondary Button */
.btn-secondary {
  padding: 8px 16px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

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