/* =============================================================================
   Greybeard Systems Dashboard - CSS Styles
   ============================================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --safe-mode-border: #16a34a;
    --danger-mode-border: #dc2626;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Safe Mode Border Indicator */
body.safe-mode {
    border-top: 4px solid var(--safe-mode-border);
}

body:not(.safe-mode) {
    border-top: 4px solid var(--danger-mode-border);
}

/* =============================================================================
   Navigation
   ============================================================================= */

.navbar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--gray-500);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: var(--gray-100);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.safe-mode-toggle {
    display: inline;
}

/* =============================================================================
   Container & Layout
   ============================================================================= */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.875rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--gray-500);
    width: 100%;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-disabled {
    background: var(--gray-200);
    color: var(--gray-500);
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* =============================================================================
   Cards & Grids
   ============================================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.dashboard-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.dashboard-card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.dashboard-card p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.dashboard-card ul {
    list-style: none;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.dashboard-card ul li {
    padding: 0.25rem 0;
}

/* LCARS Card Special Styling */
.dashboard-card.lcars-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    border: 2px solid #ff9c00;
    color: #ff9c00;
}

.dashboard-card.lcars-card:hover {
    border-color: #9999ff;
    box-shadow: 0 4px 20px rgba(255, 156, 0, 0.3);
}

.dashboard-card.lcars-card h2 {
    color: #ff9c00;
    font-family: 'Antonio', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dashboard-card.lcars-card p {
    color: #99ccff;
}

.dashboard-card.lcars-card ul li {
    color: #cc9966;
}

/* =============================================================================
   Server Cards
   ============================================================================= */

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.server-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--gray-300);
}

.server-card.server-online {
    border-left-color: var(--success);
}

.server-card.server-offline {
    border-left-color: var(--danger);
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-indicator {
    font-size: 0.875rem;
    font-weight: 500;
}

.status-indicator.online {
    color: var(--success);
}

.status-indicator.offline {
    color: var(--danger);
}

.server-info {
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.info-row .label {
    font-weight: 500;
    width: 120px;
    color: var(--gray-500);
}

/* =============================================================================
   Domain Cards
   ============================================================================= */

.domain-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.domain-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.domain-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-family: monospace;
}

.domain-actions {
    display: flex;
    gap: 0.5rem;
}

/* =============================================================================
   Tables
   ============================================================================= */

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =============================================================================
   Forms
   ============================================================================= */

.form-container {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

/* =============================================================================
   Info/Warning/Error Boxes
   ============================================================================= */

.info-box,
.warning-box,
.error-box {
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.info-box h3 {
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.warning-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.warning-box h3 {
    color: #b45309;
    margin-bottom: 0.75rem;
}

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.error-box h3 {
    color: var(--danger);
    margin-bottom: 0.75rem;
}

/* =============================================================================
   Status Banner
   ============================================================================= */

.status-banner {
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.status-banner.safe {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.status-banner.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.status-banner .icon {
    font-size: 1.25rem;
}

/* =============================================================================
   Flash Messages
   ============================================================================= */

.flash-messages {
    padding: 0 2rem;
}

.flash {
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
}

.flash-warning {
    background: #fffbeb;
    color: #b45309;
}

.flash-info {
    background: #eff6ff;
    color: #1e40af;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
}

.flash-close:hover {
    opacity: 1;
}

/* =============================================================================
   Code Blocks
   ============================================================================= */

.code-block,
pre.output {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* =============================================================================
   DNS Verification
   ============================================================================= */

.dns-check {
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.dns-check.check-pass {
    border-left: 4px solid var(--success);
}

.dns-check.check-fail {
    border-left: 4px solid var(--danger);
}

.check-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.server-name {
    font-family: monospace;
    font-weight: 600;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-error {
    background: #fef2f2;
    color: #b91c1c;
}

.check-output {
    margin: 0;
    border-radius: 0;
}

/* =============================================================================
   Server Details
   ============================================================================= */

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.detail-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-card h4 {
    margin-bottom: 0.75rem;
    color: var(--gray-500);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.server-actions-bar {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.ip-badge {
    background: var(--gray-200);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875rem;
}

/* =============================================================================
   Quick Actions
   ============================================================================= */

.quick-actions {
    margin-top: 2rem;
}

.quick-actions h3 {
    margin-bottom: 1rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* =============================================================================
   Footer
   ============================================================================= */

.footer {
    background: white;
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* =============================================================================
   Utilities
   ============================================================================= */

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-500);
}

.text-warning {
    color: var(--warning);
}

code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875em;
}

code.password {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 0.25rem 0.5rem;
}

/* =============================================================================
   Wizard Progress
   ============================================================================= */

.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    color: var(--gray-500);
    border-bottom: 3px solid var(--gray-200);
    font-size: 0.875rem;
}

.progress-step.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.progress-step.done {
    color: var(--success);
    border-bottom-color: var(--success);
}

/* =============================================================================
   Tenant Cards
   ============================================================================= */

.tenant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tenant-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--gray-300);
}

.tenant-card.tenant-managed {
    border-left-color: var(--success);
}

.tenant-card.tenant-external {
    border-left-color: var(--warning);
}

.tenant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tenant-info {
    margin-bottom: 1rem;
}

.tenant-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* =============================================================================
   Database Cards
   ============================================================================= */

.database-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.database-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--gray-300);
}

.database-card.db-managed {
    border-left-color: var(--primary);
}

.db-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.db-header h2 {
    font-family: monospace;
    font-size: 1.25rem;
}

.db-info {
    margin-bottom: 1rem;
}

.db-actions {
    display: flex;
    gap: 0.5rem;
}

.db-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .db-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   Preview/Checklist Boxes
   ============================================================================= */

.preview-box {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.preview-box h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.checklist label {
    display: block;
    padding: 0.5rem 0;
    cursor: pointer;
}

.checklist label:hover {
    background: var(--gray-50);
}

.checklist input[type="checkbox"] {
    margin-right: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checklist-markdown {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.8;
}

/* =============================================================================
   Success Banner
   ============================================================================= */

.success-banner {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.success-banner .icon {
    font-size: 1.5rem;
}

/* =============================================================================
   Completion Summary
   ============================================================================= */

.completion-summary {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.summary-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.summary-section:last-child {
    border-bottom: none;
}

.summary-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* =============================================================================
   Manual Steps
   ============================================================================= */

.manual-steps {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.manual-steps h2 {
    color: #b45309;
    margin-bottom: 1rem;
}

/* =============================================================================
   Empty State
   ============================================================================= */

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 0.5rem;
    color: var(--gray-500);
}

/* =============================================================================
   Tables Compact
   ============================================================================= */

.table-compact {
    font-size: 0.875rem;
}

.table-compact th,
.table-compact td {
    padding: 0.5rem 0.75rem;
}

/* =============================================================================
   Badge Secondary
   ============================================================================= */

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

