/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: white;
  line-height: 1.6;
}

/* Homepage styles */
body {
  background-color: #34495e;
}

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

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

.logo {
  height: 200px;
  width: 500px;
  margin-bottom: 20px;
}

.header h1 {
  color: white;
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
}

.container > h1 {
  color: white;
  font-size: 1.8rem;
  margin-bottom: 20px;
  text-align: center;
}

.status {
  color: #49cc90;
  font-weight: 600;
}

.ruler {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, #007bff, #49cc90);
  margin: 30px 0;
}

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

nav ul li {
  list-style: none;
}

.nav-button {
  display: block;
  background: #2c3e50;
  border: 2px solid #3498db;
  border-radius: 12px;
  padding: 25px;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-button:hover {
  background: #34495e;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  border-color: #5dade2;
}

.nav-button h2 {
  color: white;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.nav-link {
  color: #3498db;
  font-weight: 600;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.nav-button:hover .nav-link {
  color: #5dade2;
}

/* Admin Panel Styles */
.admin-container {
  min-height: 100vh;
  background-color: #f5f5f5;
}

.admin-header {
  background: #34495e;
  border-bottom: 1px solid #2c3e50;
  padding: 15px 20px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1001;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  color: white;
}

.admin-logo {
  height: 32px;
  width: auto;
}

/* Keep logo text white for dark header */
.admin-logo path[fill="white"] {
  fill: white !important;
}

.header-content h1 {
  color: white;
  font-size: 24px;
  font-weight: 600;
}

.back-link {
  margin-top: 8px;
}

.back-link a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 14px;
}

.back-link a:hover {
  color: white;
}

/* Login Section */
.login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 20px;
  margin-top: 80px;
}

.login-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 25px;
  color: #333;
  font-weight: 600;
}

/* Admin Dashboard */
.admin-dashboard {
  display: flex;
  min-height: calc(100vh - 80px);
}

/* Sidebar Navigation */
.admin-nav {
  background: #2c3e50;
  width: 280px;
  height: calc(100vh - 80px);
  position: fixed;
  left: 0;
  top: 80px;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.admin-nav.mobile-hidden {
  transform: translateX(-100%);
}

.nav-header {
  padding: 30px 20px 20px 20px;
  border-bottom: 1px solid #34495e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-header h3 {
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.nav-menu {
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  color: #bdc3c7;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: #34495e;
  color: white;
}

.nav-item.active {
  background: #3498db;
  color: white;
  font-weight: 500;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Content Area */
.admin-content {
  flex: 1;
  margin-left: 280px;
  margin-top: 80px;
  padding: 30px;
  background: #f5f5f5;
  min-height: calc(100vh - 80px);
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.section-header h2 {
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: white;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Checkbox Styles */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Button Styles */
.btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background: #2980b9;
}

.btn-primary {
  background: #3498db;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Message Styles */
.message {
  padding: 12px;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 15px;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.message.success {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 4px;
  border: 1px solid #ffcdd2;
  text-align: center;
}

/* Table Styles */
.table-responsive {
  overflow-x: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333 !important;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  font-size: 14px;
  color: #333;
}

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

.coupon-code {
  font-family: monospace;
  font-weight: 600;
  color: #333 !important;
}

.small-text {
  font-size: 12px;
  color: #666 !important;
}

.text-center {
  text-align: center;
}

.actions {
  white-space: nowrap;
}

.actions .btn {
  margin-right: 8px;
}

.actions .btn:last-child {
  margin-right: 0;
}

/* Status Badge */
.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

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

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

/* Tool Cards */
.tool-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
}

.tool-card h3 {
  color: #333;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 600;
}

.tool-card p {
  color: #666;
  margin-bottom: 20px;
  font-size: 14px;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.converter-section h4 {
  color: #333;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
}

.result-section {
  margin-top: 20px;
}

.result-group {
  margin-top: 15px;
}

.result-group label {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

.result-box {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  min-height: 40px;
}

.result-box span {
  flex: 1;
  color: #333;
}

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

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Mobile overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-overlay.active {
  display: block;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  /* Homepage mobile styles */
  .logo {
    height: 120px;
    width: 300px;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .container > h1 {
    font-size: 1.5rem;
  }
  
  nav ul li {
    padding: 20px;
  }
  
  nav ul li h2 {
    font-size: 1.2rem;
  }
  
  /* Admin panel mobile styles */
  .mobile-menu-toggle {
    display: block;
  }
  
  .admin-nav {
    transform: translateX(-100%);
  }
  
  .admin-nav.mobile-visible {
    transform: translateX(0);
  }
  
  .admin-content {
    margin-left: 0;
    margin-top: 80px;
    padding: 15px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
  }
  
  .section-header h2 {
    font-size: 20px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .converter-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }
  
  .modal-content {
    margin: 10px;
    max-width: calc(100% - 20px);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 15px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .result-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .tool-card {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .logo {
    height: 100px;
    width: 250px;
  }
  
  .header h1 {
    font-size: 1.8rem;
  }
  
  .container > h1 {
    font-size: 1.3rem;
  }
  
  nav ul li {
    padding: 15px;
  }
  
  .admin-content {
    padding: 10px;
  }
  
  .tool-card {
    padding: 15px;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 4px;
  }
}

/* Legacy styles for backward compatibility */
.reference-id-tool {
  margin-top: 40px;
  padding: 20px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.tool-container {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 20px;
}

.encode-container, .decode-container, .lookup-container {
  flex: 1;
  min-width: 300px;
  margin-bottom: 20px;
}

.admin-section {
  margin-top: 30px;
  padding: 20px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
}