/* =============================================
   VEEAM BACKUP MONITOR - Premium Dark Theme
   ============================================= */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161922;
    --bg-tertiary: #1e2130;
    --bg-card: #1a1d2e;
    --bg-hover: #252840;
    --border: #2a2d42;
    --border-light: #353852;

    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --success-glow: rgba(34, 197, 94, 0.3);

    --failure: #ef4444;
    --failure-bg: rgba(239, 68, 68, 0.12);
    --failure-glow: rgba(239, 68, 68, 0.3);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --warning-glow: rgba(245, 158, 11, 0.3);

    --noemail: #a855f7;
    --noemail-bg: rgba(168, 85, 247, 0.12);
    --noemail-glow: rgba(168, 85, 247, 0.3);

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.12), transparent);
    pointer-events: none;
    z-index: 0;
}

/* =============================================
   HEADER
   ============================================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

.header-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-danger {
    background: var(--failure-bg);
    color: var(--failure);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* =============================================
   STATS BAR
   ============================================= */

.stats-bar {
    display: flex;
    gap: 16px;
    padding: 24px 32px;
    position: relative;
    z-index: 1;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.stat-success .stat-number { color: var(--success); }
.stat-failure .stat-number { color: var(--failure); }
.stat-warning .stat-number { color: var(--warning); }
.stat-noemail .stat-number { color: var(--noemail); }

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
    padding: 0 32px 40px;
    position: relative;
    z-index: 1;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.table-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: border-color var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    width: 200px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* =============================================
   CLIENTS TABLE
   ============================================= */

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table thead th {
    padding: 14px 24px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.clients-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.clients-table tbody tr:last-child {
    border-bottom: none;
}

.clients-table tbody tr:hover {
    background: var(--bg-hover);
}

.clients-table td {
    padding: 16px 24px;
    font-size: 0.9rem;
    vertical-align: middle;
}

.client-name {
    font-weight: 600;
    color: var(--text-primary);
}

.client-email {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: 'Consolas', 'Courier New', monospace;
}

.backup-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.backup-date .date-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* =============================================
   STATUS BADGES
   ============================================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.status-badge:hover {
    transform: scale(1.05);
}

.status-badge .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-badge.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.status-badge.success .dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}
.status-badge.success:hover {
    box-shadow: 0 0 20px var(--success-glow);
}

.status-badge.failure {
    background: var(--failure-bg);
    color: var(--failure);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.status-badge.failure .dot {
    background: var(--failure);
    box-shadow: 0 0 8px var(--failure-glow);
}
.status-badge.failure:hover {
    box-shadow: 0 0 20px var(--failure-glow);
}

.status-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.status-badge.warning .dot {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning-glow);
}
.status-badge.warning:hover {
    box-shadow: 0 0 20px var(--warning-glow);
}

.status-badge.no_email {
    background: var(--noemail-bg);
    color: var(--noemail);
    border: 1px solid rgba(168, 85, 247, 0.2);
}
.status-badge.no_email .dot {
    background: var(--noemail);
    box-shadow: 0 0 8px var(--noemail-glow);
}
.status-badge.no_email:hover {
    box-shadow: 0 0 20px var(--noemail-glow);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* =============================================
   ACTION BUTTONS
   ============================================= */

.actions-cell {
    display: flex;
    gap: 6px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.action-btn.delete:hover {
    background: var(--failure-bg);
    color: var(--failure);
    border-color: rgba(239, 68, 68, 0.3);
}

/* =============================================
   MODALS
   ============================================= */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================
   FORMS
   ============================================= */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.form-check {
    display: flex;
    align-items: center;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
    color: var(--text-primary);
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* =============================================
   DETAILS VIEW
   ============================================= */

.detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-meta-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.detail-meta-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.detail-content table {
    width: 100%;
    border-collapse: collapse;
}

.detail-content td,
.detail-content th {
    padding: 6px 10px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
}

.detail-content img {
    max-width: 100%;
}

/* =============================================
   HISTORY VIEW
   ============================================= */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.history-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.history-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-dot.success { background: var(--success); box-shadow: 0 0 6px var(--success-glow); }
.history-dot.failure { background: var(--failure); box-shadow: 0 0 6px var(--failure-glow); }
.history-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning-glow); }

.history-info {
    flex: 1;
}

.history-subject {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.history-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-top: 16px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.empty-state p {
    margin: 8px 0 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 300px;
    max-width: 450px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--failure); }
.toast.info { border-left: 3px solid var(--accent); }

.toast-message {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =============================================
   LOADING SPINNER
   ============================================= */

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .btn span {
        display: none;
    }

    .btn {
        padding: 10px;
    }

    .stats-bar {
        padding: 16px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        padding: 14px;
    }

    .main-content {
        padding: 0 16px 24px;
    }

    .clients-table thead {
        display: none;
    }

    .clients-table tbody tr {
        display: flex;
        flex-direction: column;
        padding: 16px;
        gap: 8px;
    }

    .clients-table td {
        padding: 0;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   SCROLLBAR
   ============================================= */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
