/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    background: #f8fafc;
    color: #333;
}

a {
    color: #3b82f6;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

code {
    display: inline-block;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    color: #d63384;
}

/* === Layout === */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* === Navbar === */
.navbar {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-brand img {
    height: 50px;
}

.navbar-link {
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
}
.navbar-link:hover {
    color: #3b82f6;
    text-decoration: none;
}

.navbar-spacer {
    flex: 1;
}

.navbar-user {
    position: relative;
}

.navbar-user-btn {
    background: none;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    color: #333;
}
.navbar-user-btn:hover {
    background: #f8f9fa;
}

.navbar-user-btn.is-admin {
    color: #c2410c;
    font-weight: 700;
    border-color: #c2410c;
}

.navbar-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 140px;
    z-index: 200;
}

.navbar-dropdown a {
    display: block;
    padding: 8px 16px;
    color: #333;
    font-size: 0.85rem;
}
.navbar-dropdown a:hover {
    background: #f8f9fa;
    text-decoration: none;
}

/* === Main Content === */
main {
    padding: 2rem 0;
}

/* === Welcome / Instructions === */
.welcome h2 {
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.welcome p {
    margin-bottom: 0.75rem;
}

.welcome strong {
    color: #1e293b;
}

.welcome ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.welcome li {
    margin-bottom: 0.4rem;
}

.welcome hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

.welcome .note {
    font-style: italic;
    color: #64748b;
}

.welcome .config-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    margin: 0.75rem 0 1rem;
    overflow-x: auto;
    white-space: pre;
}

.welcome .config-block code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* === Login Page === */
.login-wrapper {
    max-width: 420px;
    margin: 3rem auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 2rem;
}

.login-wrapper h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-group-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.form-group-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.form-group-check label {
    font-weight: 400;
    font-size: 0.85rem;
    color: #475569;
}

.form-error {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
.btn:hover {
    background: #f1f5f9;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}
.btn-primary:hover {
    background: #2563eb;
}

.btn-active {
    background: #86efac;
    border-color: #22c55e;
    color: #166534;
}

.btn-inactive {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #475569;
}

.btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}
.btn-danger:hover {
    background: #fef2f2;
}

.btn-group {
    display: flex;
    gap: 6px;
}

/* === Cards (DNS Server) === */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
}

.card-header-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
}

.card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
}

.group-header {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0369a1;
    background: #e0f2fe;
    padding: 8px 16px;
    border-radius: 6px;
    margin: 1.25rem 0 0.5rem;
}

.card-note {
    color: #64748b;
    font-size: 0.85rem;
    flex: 1;
}

.card-date {
    color: #94a3b8;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* === Input / Textarea (inline edit) === */
.input-inline {
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 180px;
}
.input-inline:focus {
    outline: none;
    border-color: #3b82f6;
}

.textarea-inline {
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
    resize: vertical;
    min-height: 40px;
}
.textarea-inline:focus {
    outline: none;
    border-color: #3b82f6;
}

/* === Dialog / Modal === */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.dialog-content {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.dialog-content p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === Flash Messages === */
.flash-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: flash-in 0.3s ease;
}

.flash-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.flash-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Responsive === */
@media (max-width: 640px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .card-body {
        flex-direction: column;
        align-items: flex-start;
    }
    .navbar .container {
        flex-wrap: wrap;
    }
}
