/* style.css */
:root {
  --primary-bg: #FFFFFF;
  --secondary-bg: #F8F9FA;
  --primary-text: #212529;
  --accent-color: #0D6EFD;
  --accent-color-hover: #0B5ED7;
  --status-success: #198754;
  --status-warning: #FFC107;
  --status-danger: #DC3545;
  --border-color: #DEE2E6;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--secondary-bg);
  color: var(--primary-text);
  margin: 0;
  line-height: 1.6;
  padding-bottom: 50px; /* Add padding to the bottom of the body */
}

.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.header .logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--primary-text);
}

.header nav a {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--accent-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.25rem;
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: var(--accent-color-hover);
}

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

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

/* Forms */
.form-card {
  background-color: var(--primary-bg);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  max-width: 400px;
  margin: 4rem auto;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary-text);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: var(--accent-color);
}

.tab-button.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: bold;
}

.close-tab-btn {
    margin-left: 8px;
    color: #6c757d;
    cursor: pointer;
    font-weight: bold;
}

.close-tab-btn:hover {
    color: #343a40;
}


.tab-content {
    display: none;
}

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

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  box-sizing: border-box;
}

/* Table */
.permissions-table,
.audit-log-table,
.domain-table,
.notification-channels-table,
.notification-rules-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--primary-bg);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}


.permissions-table, .permissions-table td, .permissions-table th,
.audit-log-table, .audit-log-table td, .audit-log-table th {
    border: 1px solid;
}

.domain-table th, .domain-table td,
.notification-channels-table th, .notification-channels-table td,
.notification-rules-table th, .notification-rules-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.domain-table th,
.notification-channels-table th,
.notification-rules-table th {
  background-color: var(--secondary-bg);
}

.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  box-sizing: border-box;
}

.status-dot {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  display: inline-block;
}
.status-enabled { background-color: var(--status-success); }
.status-disabled { background-color: var(--status-danger); }

.status-valid { background-color: var(--status-success); }
.status-expiring_soon { background-color: var(--status-warning); }
.status-expired { background-color: var(--status-danger); }
.status-pending { background-color: #6c757d; }

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

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 500px;
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.auth-layout-grid {
    display: grid;
    grid-template-columns: 1fr 450px 1fr;
    grid-template-rows: 1fr auto 1fr;
    /*height: 150vh; !* Make it scrollable *!*/
    width: 100%;
    position: relative;
    overflow: auto;
}

.content-panel {
    padding: 2rem;
    text-align: center;
}

.top-content { grid-column: 1 / 4; grid-row: 1; align-self: end; }
.left-content { grid-column: 1; grid-row: 2; align-self: center; }
.right-content { grid-column: 3; grid-row: 2; align-self: center; }
.bottom-content { grid-column: 1 / 4; grid-row: 3; align-self: start; }

.center-form-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 400px; /* Fixed width for the form card */
}

.form-card {
    margin: 0; /* Reset margin as it's now centered by the container */
}

.toggle-link {
    margin-top: 1rem;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 0.25rem;
}

.dropdown-menu a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-menu a.btn {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 0;
    border: none;
}

.dropdown-menu a.btn:hover {
    background-color: #f1f1f1;
    color: black;
}

.dropdown-divider {
    height: 1px;
    margin: .5rem 0;
    overflow: hidden;
    background-color: #e9ecef;
}

/* WHOIS-specific styles */
.domain-filters {
    background-color: var(--primary-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    white-space: nowrap;
}

.filter-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background-color: var(--primary-bg);
    min-width: 120px;
}

/* Expiry status indicators */
.expiry-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.expiry-info-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.expiry-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.expiry-item.domain-expiry-alert {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 0.375rem;
    padding: 0.5rem;
    position: relative;
}

.expiry-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expiry-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.expiry-date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-left: 0.5rem;
}

.alert-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background-color: #dc3545;
    color: white;
    font-size: 0.625rem;
    font-weight: bold;
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.expiry-good {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.expiry-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.expiry-critical {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.expiry-expired {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-weight: bold;
}

.expiry-unknown {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* WHOIS info tab styles */
.whois-info-container,
.whois-history-container {
    padding: 1rem;
}

.whois-actions {
    margin-bottom: 1.5rem;
}

.whois-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.whois-section {
    background-color: var(--primary-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.whois-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.whois-field {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.whois-field label {
    font-weight: 600;
    min-width: 120px;
    margin-right: 1rem;
    color: #495057;
}

.whois-field span {
    flex: 1;
    word-break: break-word;
}

.name-servers {
    line-height: 1.4;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

.error-section {
    border-left: 4px solid var(--status-danger);
}

.error-message {
    color: var(--status-danger);
    font-family: monospace;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 0.25rem;
    display: block;
    margin-top: 0.25rem;
}

/* WHOIS history styles */
.whois-history-timeline {
    position: relative;
    padding-left: 2rem;
}

.whois-history-timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.history-entry {
    position: relative;
    margin-bottom: 1.5rem;
    background-color: var(--primary-bg);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-icon {
    position: absolute;
    left: -2.5rem;
    top: 1rem;
    width: 2rem;
    height: 2rem;
    background-color: var(--primary-bg);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.history-content {
    padding: 1rem 1.5rem;
}

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

.history-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.history-changes {
    font-size: 0.875rem;
}

.change-old {
    color: #721c24;
    background-color: #f8d7da;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.change-new {
    color: #155724;
    background-color: #d4edda;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.change-same {
    color: #495057;
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.loading::before {
    content: '⏳ ';
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    background-color: var(--secondary-bg);
    border-radius: 0.5rem;
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--status-danger);
    background-color: #f8d7da;
    border-radius: 0.5rem;
    border: 1px solid #f5c6cb;
}

/* Responsive design */
@media (max-width: 768px) {
    .domain-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: space-between;
    }
    
    .whois-info-grid {
        grid-template-columns: 1fr;
    }
    
    .whois-field {
        flex-direction: column;
    }
    
    .whois-field label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .history-entry {
        margin-left: -1rem;
    }
    
    .history-icon {
        left: -1.5rem;
    }
    
    .expiry-info-container {
        gap: 0.25rem;
    }
    
    .expiry-item {
        font-size: 0.8rem;
    }
    
    .expiry-label {
        font-size: 0.7rem;
    }
    
    .expiry-status {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
    
    .expiry-date {
        font-size: 0.7rem;
    }
}