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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f1220 0%, #1a2035 100%);
    color: #e7e9ee;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Containers */
.container, .dashboard-container, .container-home {
    max-width: 960px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
}

/* Headings */
h1, h2 {
    margin: 0 0 16px 0;
    text-align: center;
    color: #fff;
}

h1 {
    font-size: 28px;
    margin-bottom: 16px;
    font-weight: 700;
}

p {
    color: #9aa3b2;
    line-height: 1.6;
    margin-bottom: 32px;
    font-size: 16px;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(114, 137, 218, 0.3) 50%, transparent 100%);
    margin: 24px 0;
}

/* Buttons */

.btn.btn-danger {
	background: #dc3545;
}

.btn:hover {
    background: #6587e0;
}
.btn.alt {
    background: transparent;
    border-color: #7c9cff;
    color: #7c9cff;
}
.btn.danger {
    background: #ff6b6b;
    color: #fff;
}
.btn.warn {
    background: #ffd166;
    color: #333;
}
.btn.small {
    padding: 6px 10px;
    font-size: .9rem;
}

/* Input fields and labels */
.input,
.input[type="text"],
.input[type="url"],
.input[type="search"],
.input[type="email"],
.input[type="password"],
select.input,
textarea.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(114, 137, 218, 0.3); /* Light purple-blue border */
    border-radius: 8px;
    background: rgba(10, 14, 28, 0.4);          /* Dark translucent blue background */
    color: #e7e9ee;                             /* Light grayish text color */
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    border-color: #7289da;                      /* Bright blue border on focus */
    box-shadow: 0 0 0 2px rgba(114, 137, 218, 0.2); /* Blue glow around input on focus */
}

.label {
    font-size: .9rem;
    color: #666;
    margin-bottom: 6px;
    display: block;
}

/* Grid layout */
.grid {
    display: grid;
    gap: 12px;
}
.grid-2 {
    grid-template-columns: 1fr 1fr;
}

/* Responsive table wrapper */
.table-wrapper {
    overflow-x: auto;
    margin-top: 20px; /* updated per your snippet */
    -webkit-overflow-scrolling: touch;
}

/* Table styles merged with updated snippet */
.table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1f38; /* Slightly lighter dark blue to contrast with body */
    color: #dbe2ff; /* Light bluish-gray text for readability */
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(124, 156, 255, 0.3); /* subtle blue glow */
    margin-top: 16px; /* keep margin consistent with original */
}

.table thead tr {
    background: #1a1f38;
    border-bottom: 2px solid #7c9cff;
}

.table thead th {
    text-align: center;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #e1e7ff;
    user-select: none;
}

.table tbody tr {
    border-bottom: 1px solid rgba(124, 156, 255, 0.2);
    transition: background-color 0.2s ease;
    cursor: default;
    background: transparent;
}

.table tbody tr:hover {
    background-color: rgba(124, 156, 255, 0.15);
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
    color: inherit;
}

/* Preserve existing table-specific styles */
.table td.deletion-reason {
    color: #b00020;
    font-style: italic;
}

/* Row highlighting by status */
.table tr.active {
    background-color: #d1d9f7;
}
.table tr.grace {
    background-color: #fde7ae;
}
.table tr.expired {
    background-color: #f39c9c;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    display: inline-block;
}
.badge.ok {
    background-color: #7c9cff;
    color: #fff;
}
.badge.warn {
    background-color: #ffcc66;
    color: #333;
}
.badge.danger {
    background-color: #ff6666;
    color: #fff;
}
.badge.renewable {
    background-color: #f59e0b;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}
.badge.disabled {
    background-color: black;
    color: white;
    border-radius: 999px;
    padding: 4px 12px;
    display: inline-block;
    min-width: auto;
    text-align: center;
    font-weight: bold;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Disabled row background: hazard yellow */
.redirect-row.disabled {
    background-color: #ffecb3 !important; /* hazard yellow */
}

/* Optional: style the deletion reason text */
.disabled-reason {
    color: #aa0000;
    font-style: italic;
    font-weight: 600;
}

/* Countdown */
.countdown.ok {
    color: #2ecc71;
    font-weight: 600;
}
.countdown.warn {
    color: #ffd166;
    font-weight: 600;
}
.countdown.danger {
    color: #ff6b6b;
    font-weight: 600;
}

/* Misc */
.muted {
    color: #666;
}
.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 6px;
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
form.inline {
    display: inline;
}
.spacer {
    height: 12px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .table th, .table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Admin Login Page */
.admin-login-container {
    min-width: 400px;
    margin: 80px auto;
    background: #151a2b; /* match dashboard card background */
    padding: 30px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    text-align: center;
}

.admin-login-container h2 {
    color: #e7e9ee;
    margin-bottom: 24px;
}

.admin-login-container form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-login-container input[type="text"],
.admin-login-container input[type="password"] {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #2a324a;
    background: #0d1120;
    color: #e7e9ee;
    font-size: 14px;
}

.admin-login-container .btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #7c9cff;
    color: #0b1020;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all .2s;
    cursor: pointer;
}

.admin-login-container .btn:hover {
    background: #6587e0;
}

/* Footer */
footer {
    text-align: center;
    color: #9aa3b2;
    font-size: 0.9rem;
}

footer a.footer-link {
    color: #7c9cff;
    text-decoration: none;
    margin-left: 5px;
}

footer a.footer-link:hover {
    text-decoration: underline;
}

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

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

.close:hover {
    color: black;
}

/* Card */
.card {
    background: #151a2b;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(114, 137, 218, 0.15);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #7289da, #5b6eae);
    border-radius: 16px 16px 0 0;
}

/* Features */
.features {
    text-align: left;
    margin-top: 32px;
    padding: 20px;
    background: rgba(10, 14, 28, 0.4);
    border-radius: 12px;
}

.features h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #7289da;
}

.features ul {
    list-style: none;
}

.features li {
    margin-bottom: 10px;
    padding-left: 24px;
    position: relative;
    color: #9aa3b2;
}

.features li::before {
    content: "✓";
    color: #7289da;
    position: absolute;
    left: 0;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 160px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 6px 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -80px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Back Link */
.back-link {
    color: #7289da;
    text-decoration: none;
    margin-bottom: 20px;
    display: inline-block;
    transition: color 0.2s ease;
}
.back-link:hover {
    color: #5b6eae;
}

/* Alerts */
.alert.alert-danger {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #2d1b1b; /* Dark red background */
    border: 1px solid #ff6b6b; /* Red border */
    color: #ffcccb; /* Light red text */
}

.alert.alert-danger strong {
    color: #ff6b6b; /* Brighter red for bold text */
}

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

.btn.small.warn:hover {
	background-color: #ffb50a;
}

.btn.small.renewable {
	background-color: #f59e0b;
}

.btn.small.renewable:hover {
	background-color: #ebb55a;
}

/* Renewable buttons */
.btn.renewable:hover {
    background-color: #d97706;
    border-color: #d97706;
}

.btn {
  padding: 6px 12px;
  margin: 0 3px;
  border: 1px solid #ccc;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.9rem;
}

.btn:hover:not(:disabled) {
  background: #47628b;
}

.btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.btn-current {
  background: #007bff;
  color: white;
  border-color: #007bff;
  cursor: default;
}

/* Floating Referral Icon Button */
.referral-icon-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #7289da;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(114, 137, 218, 0.5);
  transition: all 0.2s ease;
  font-size: 24px;
  z-index: 1000;
}

.referral-icon-button:hover {
  background: #5b6eae;
  transform: scale(1.1);
}

/* Referral Popup */
.referral-popup {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 30px;
  background: #151a2b;
  border: 1px solid rgba(114, 137, 218, 0.15);
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1001;
}

.referral-popup.active {
  display: block;
}

.referral-popup h4 {
  color: #fff;
  font-size: 16px;
  margin: 0 0 10px 0;
}

.referral-popup p {
  color: #9aa3b2;
  font-size: 13px;
  margin: 0 0 15px 0;
  line-height: 1.5;
}

.referral-input-group {
  display: flex;
  gap: 8px;
}

.referral-input-group input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #2a324a;
  background: #0d1120;
  color: #e7e9ee;
  border-radius: 8px;
  font-size: 13px;
  font-family: monospace;
}

.btn-copy-referral {
  padding: 10px 16px;
  background: #7289da;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-copy-referral:hover {
  background: #5b6eae;
}

#editUrlModal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#editUrlModal .modal-content {
  background: #151a2b;
  border: 1px solid rgba(114, 137, 218, 0.15);
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

#editUrlModal .modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #7289da, #5b6eae);
  border-radius: 16px 16px 0 0;
}

#editUrlModal h3 {
  color: #fff;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
}

#editUrlModal .close-edit {
  color: #9aa3b2;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
  transition: color 0.2s ease;
}

#editUrlModal .close-edit:hover {
  color: #fff;
}

#editUrlModal .label {
  color: #9aa3b2;
  font-size: 14px;
  margin-bottom: 8px;
  display: block;
  text-align: left;
}

#editUrlModal .input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2a324a;
  background: #0d1120;
  color: #e7e9ee;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

#editUrlModal .input:focus {
  outline: none;
  border-color: #7289da;
}

#editUrlModal .muted {
  color: #9aa3b2;
  font-size: 13px;
  text-align: left;
}

/* Editable URL styling */
.editable-url {
  transition: all 0.2s ease;
}

.editable-url:hover {
  color: #7289da !important;
  text-decoration: underline !important;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  #editUrlModal .modal-content {
    width: 95%;
    padding: 20px;
  }
  
  #editUrlModal h3 {
    font-size: 18px;
  }
}