:root {
  --bg-body: #020617;
  --bg-card: #0f172a;
  --bg-input: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --danger-color: #ef4444; 
  --success-color: #10b981;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-body);
  padding-top: 0;
}

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

/* Header */
.header {
  background-color: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

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

.logo {
  font-size: 1.8rem;
  color: white; 
  font-weight: bold;
}

/* Helper for logo part color if used in HTML */
.logo span {
  color: var(--primary-color);
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid #334155; 
}

.btn-outline:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: white;
}

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-secondary {
  background-color: #4b5563;
  color: white;
}

.btn-secondary:hover {
  background-color: #374151;
}

.btn-warning {
  background-color: #f59e0b;
  color: white;
}

.btn-warning:hover {
  background-color: #d97706;
}

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

.btn-success:hover {
  background-color: #059669;
}

/* Main Content */
.main {
  padding: 1rem 0;
  min-height: auto;
}

/* Forms */
.form-container {
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.form-container:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: #334155;
}

.form-container h2 {
  margin-bottom: 1.5rem;
  color: var(--text-main);
  text-align: center;
}

.form-group {
  margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid #334155;
  color: var(--text-main);
  border-radius: 6px;
  font-size: 1rem;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #64748b;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-submit {
  width: 100%;
}

.form-footer {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.form-footer a:hover {
  text-decoration: underline;
}
#createUrlForm .btn-primary {
  margin-bottom: 10px;
}
/* Alert Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.alert-error {
  background: rgba(127, 29, 29, 0.2);
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

.alert-error::before {
  background: #dc2626;
}

.alert-success {
  background: rgba(6, 78, 59, 0.2);
  color: #6ee7b7;
  border: 1px solid #064e3b;
}

.alert-success::before {
  background: #10b981;
}

.alert-info {
  background: rgba(30, 58, 138, 0.2);
  color: #93c5fd;
  border: 1px solid #1e3a8a;
}

.alert-info::before {
  background: #3b82f6;
}

/* URL List */
.url-list {
  display: grid;
  gap: 1rem;
  padding: 0;
}

.url-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.url-summary-count {
  font-size: 0.95rem;
}

.url-summary-page {
  font-size: 0.875rem;
  color: #64748b;
}

.url-item {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: start;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.url-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary-color) 0%, #60a5fa 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.url-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  border-color: #334155;
}

.url-item:hover::before {
  opacity: 1;
}

.url-item-inactive {
  background: rgba(15, 23, 42, 0.6);
  border-color: #1e293b;
}

.url-item-inactive::before {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
}

.url-item-inactive:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: #334155;
  background: var(--bg-card);
}

.url-info {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.url-info h3 {
  color: var(--text-main);
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  letter-spacing: -0.01em;
  flex-wrap: wrap;
  word-break: break-word;
}

.url-info p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

.url-info a {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s;
}

.url-info a:hover {
  color: #60a5fa;
  text-decoration: none;
}

.url-short {
  color: #60a5fa; 
  font-weight: 600;
  background: rgba(59, 130, 246, 0.1);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  display: inline-block;
  transition: all 0.2s ease;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.url-short:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.url-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-self: center;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 8px;
  font-weight: 500;
  background-color: #1e293b;
  color: var(--text-muted);
  border: 1px solid #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-small:hover {
  transform: translateY(-1px);
  background-color: #334155;
  color: var(--text-main);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-small:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}
.btn-active:hover {
  background-color: var(--primary-hover);
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination-pages {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  color: #64748b;
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.59rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.badge-active {
  background: rgba(6, 78, 59, 0.3);
  color: #6ee7b7;
  border: 1px solid #064e3b;
}

.badge-active::before {
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.badge-inactive {
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

.badge-inactive::before {
  background-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h2 {
  color: var(--text-main);
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.2s;
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg-card);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s;
  border: 1px solid var(--border-color);
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: #334155;
  color: white;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

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

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .hero h2 {
    font-size: 2rem;
  }

  .url-item {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .url-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .url-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .pagination-controls {
    flex-direction: column;
    gap: 0.75rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* Home hero styles (Dark Mode Updated) */
.home-hero { 
    display:flex; 
    gap:2rem; 
    align-items:center; 
    justify-content:space-between; 
    padding:2rem; 
    border-radius:12px; 
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.2) 60%); 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.home-hero .hero-left { flex:1; }
.home-hero h2 { margin:0 0 .5rem; font-size:1.9rem; color: #f8fafc; }
.home-hero p { margin:0 0 1rem; color:#94a3b8; }
.quick-shorten { display:flex; gap:.5rem; align-items:center; }
.quick-shorten input[type="url"]{ 
    flex:1; 
    padding:.85rem .75rem; 
    border-radius:8px; 
    background: #0b1120;
    border:1px solid #334155; 
    color: white;
    transition: all 0.18s ease; 
}
.quick-shorten input[type="url"]:focus { 
    outline: none; 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); 
}
.feature-list{ display:flex; gap:0.75rem; margin-top:2rem; }
.feature-card{ 
    flex:1; 
    padding:1rem; 
    border-radius:8px; 
    background:rgba(30, 41, 59, 0.5); 
    border:1px solid rgba(255, 255, 255, 0.05); 
    text-align:center; 
    transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-2px); background: rgba(30, 41, 59, 0.8); }
.feature-card div:first-child { color:#e2e8f0; font-weight:600; }
.stat-anim{ font-weight:700; color:var(--primary-color); }
.home-stats-panel { 
    background:linear-gradient(180deg, #1e293b, #0f172a); 
    padding:1.5rem; 
    border-radius:12px; 
    border:1px solid #334155; 
    box-shadow:0 10px 25px rgba(0, 0, 0, 0.3); 
}


@media (max-width: 600px) {
  .home-hero {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding: 1rem;
  }
  .hero-left, .hero-right {
    width: 100% !important;
    text-align: left;
    margin: 0 0 1.5rem 0;
    text-align: center;
  }
  .feature-list {
    flex-direction: column;
    gap: .4rem;
    text-align: center;
  }
  .feature-card {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  .home-stats-panel {
    margin: 1rem 0 0 0;
  }
  .quick-shorten {
    flex-direction: column;
    gap: 0.5rem;
  }
  #quickOriginalUrl, #quickShortenBtn {
    width: 100%;
  }
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  min-width: 250px;
  max-width: 350px;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  animation: toastSlideIn 0.3s ease-out forwards;
}

.toast.hiding {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-success {
  background-color: #059669; /* Emerald 600 */
}

.toast-error {
  background-color: #dc2626; /* Red 600 */
}

.toast-warning {
  background-color: #d97706; /* Amber 600 */
}

.toast-info {
  background-color: #2563eb; /* Blue 600 */
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

