/* ZFS Dashboard — Dark Theme CSS */

/* ===== Variables ===== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --card-bg: #1e2a4a;
    --border-color: #2a3a5a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-muted: #757575;
    --color-success: #00c853;
    --color-warning: #ff9800;
    --color-danger: #f44336;
    --color-info: #29b6f6;
    --color-offline: #757575;
    --nav-bg: #12122a;
    --nav-hover: #1e2a4a;
    --nav-active: #0f3460;
    --input-bg: #0f1a30;
    --input-border: #2a3a5a;
    --input-focus: #29b6f6;
    --btn-primary-bg: #1565c0;
    --btn-primary-hover: #1976d2;
    --btn-danger-bg: #c62828;
    --btn-danger-hover: #d32f2f;
    --btn-secondary-bg: #37474f;
    --btn-secondary-hover: #455a64;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

a {
    color: var(--color-info);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Layout ===== */
.app-layout {
    display: flex;
    min-height: calc(100vh - 40px);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* ===== Sidebar Navigation ===== */
.sidebar {
    width: 220px;
    background: var(--nav-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.nav-list {
    list-style: none;
    padding: 0.5rem 0;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--nav-active);
    color: var(--text-primary);
    border-left: 3px solid var(--color-info);
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-label {
    font-size: 0.9rem;
}

/* ===== Footer ===== */
.app-footer {
    background: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Cards / Panels ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 0.7rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tbody tr:hover {
    background: var(--nav-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: #ffffff;
}

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

.btn-danger {
    background: var(--btn-danger-bg);
    color: #ffffff;
}

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

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
}

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

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    font-family: var(--font-family);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 2px rgba(41, 182, 246, 0.2);
}

input::placeholder {
    color: var(--text-muted);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ===== Status Colors / Utility Classes ===== */
.text-success {
    color: var(--color-success);
}

.text-warning {
    color: var(--color-warning);
}

.text-danger {
    color: var(--color-danger);
}

.text-muted {
    color: var(--text-muted);
}

.text-info {
    color: var(--color-info);
}

/* Health status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-online {
    background: rgba(0, 200, 83, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(0, 200, 83, 0.3);
}

.badge-degraded {
    background: rgba(255, 152, 0, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-faulted {
    background: rgba(244, 67, 54, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.badge-offline {
    background: rgba(117, 117, 117, 0.15);
    color: var(--color-offline);
    border: 1px solid rgba(117, 117, 117, 0.3);
}

/* ===== Progress Bar ===== */
.progress {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-info);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.warning {
    background: var(--color-warning);
}

.progress-bar.danger {
    background: var(--color-danger);
}

/* ===== Alerts / Banners ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-warning {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.3);
    color: var(--color-warning);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
    color: var(--color-danger);
}

.alert-info {
    background: rgba(41, 182, 246, 0.1);
    border-color: rgba(41, 182, 246, 0.3);
    color: var(--color-info);
}

/* ===== Stat Blocks ===== */
.stat {
    text-align: center;
    padding: 1rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Confirmation Dialog ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.confirm-dialog {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.confirm-dialog h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.confirm-dialog p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-list {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .nav-item {
        margin: 0;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        border-radius: var(--radius);
    }

    .nav-link.active {
        border-left: none;
        background: var(--nav-active);
    }

    .nav-icon {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .sidebar-header {
        padding: 0.75rem;
    }

    .sidebar-title {
        font-size: 1rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Inline Code ===== */
code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
