:root {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-subtle: #1e293b;
    
    --brand-primary: #d92d20; /* Trend Micro Red */
    --brand-primary-hover: #b42318;
    --brand-accent: #0284c7;
    
    --status-success-bg: rgba(16, 185, 129, 0.15);
    --status-success-text: #34d399;
    --status-success-border: rgba(16, 185, 129, 0.3);

    --status-failed-bg: rgba(239, 68, 68, 0.15);
    --status-failed-text: #f87171;
    --status-failed-border: rgba(239, 68, 68, 0.3);

    --status-running-bg: rgba(14, 165, 233, 0.15);
    --status-running-text: #38bdf8;
    --status-running-border: rgba(14, 165, 233, 0.3);

    --status-other-bg: rgba(148, 163, 184, 0.15);
    --status-other-text: #cbd5e1;
    --status-other-border: rgba(148, 163, 184, 0.3);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-logo {
    width: 28px;
    height: 28px;
    background: var(--brand-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    color: white;
    box-shadow: 0 0 10px rgba(217, 45, 32, 0.5);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-btn:hover {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--bg-surface-elevated);
    color: #fff;
    border-bottom: 2px solid var(--brand-primary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background-color: var(--bg-surface-elevated);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.user-icon {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Metric Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
    border-color: var(--bg-surface-elevated);
    transform: translateY(-2px);
}

.stat-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-total .stat-value { color: #f8fafc; }
.stat-success .stat-value { color: #34d399; }
.stat-failed .stat-value { color: #f87171; }
.stat-running .stat-value { color: #38bdf8; }
.stat-today .stat-value { color: #fbbf24; }

/* Action Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    background-color: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

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

.input-control, .select-control {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.input-control:focus, .select-control:focus {
    border-color: var(--brand-accent);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

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

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

.btn-secondary:hover {
    background-color: #475569;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Data Tables */
.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table th {
    background-color: rgba(15, 23, 42, 0.6);
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(51, 65, 85, 0.4);
    cursor: pointer;
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid transparent;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
    border-color: var(--status-success-border);
}
.badge-success .badge-dot { background-color: var(--status-success-text); }

.badge-failed {
    background-color: var(--status-failed-bg);
    color: var(--status-failed-text);
    border-color: var(--status-failed-border);
}
.badge-failed .badge-dot { background-color: var(--status-failed-text); }

.badge-running {
    background-color: var(--status-running-bg);
    color: var(--status-running-text);
    border-color: var(--status-running-border);
}
.badge-running .badge-dot { 
    background-color: var(--status-running-text);
    animation: pulse 1.5s infinite;
}

.badge-other {
    background-color: var(--status-other-bg);
    color: var(--status-other-text);
    border-color: var(--status-other-border);
}
.badge-other .badge-dot { background-color: var(--status-other-text); }

@keyframes pulse {
    0% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 0.25rem;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Event Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -1.5rem;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 3px solid var(--brand-accent);
}

.timeline-dot.success { border-color: #34d399; }
.timeline-dot.failed { border-color: #f87171; }
.timeline-dot.running { border-color: #38bdf8; }

.timeline-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.timeline-time {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.8rem;
}

.timeline-status {
    font-weight: 700;
}

.timeline-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    background-color: rgba(15, 23, 42, 0.4);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--border-color);
}

/* Detail Info Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    background-color: rgba(15, 23, 42, 0.4);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

/* Customer Portal / Deploy Page */
.deploy-hero {
    max-width: 800px;
    margin: 2rem auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.deploy-steps {
    display: flex;
    justify-content: space-between;
    margin: 2.5rem 0;
    gap: 1rem;
    text-align: left;
}

.step-card {
    flex: 1;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
}

.step-num {
    display: inline-block;
    width: 26px;
    height: 26px;
    background-color: var(--brand-primary);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.step-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.step-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-download-hero {
    font-size: 1.15rem;
    padding: 0.85rem 2rem;
    background: linear-gradient(135deg, #d92d20, #b42318);
    box-shadow: 0 4px 14px rgba(217, 45, 32, 0.4);
}

.btn-download-hero:hover {
    box-shadow: 0 6px 20px rgba(217, 45, 32, 0.6);
    transform: translateY(-1px);
}

/* Alert Box */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-info {
    background-color: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--brand-accent);
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Code Snippet */
pre.code-box {
    background-color: #0b1120;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    overflow-x: auto;
    margin-top: 0.5rem;
}
