/**
 * Custom styles for Xray Web Manager
 * Version: Turn 23 (Approved Colors) + Icon Fix
 */

:root {
    --tblr-primary: #1a237e;
    --tblr-body-bg: #f4f6f8;
    --tblr-card-bg: #ffffff;
    --tblr-card-border-color: rgba(226, 232, 240, 0.6);
    --tblr-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    /* Solid, readable status colors */
    --status-success-bg: #e6fcf5;
    --status-success-text: #087f5b;
    --status-danger-bg: #fff5f5;
    --status-danger-text: #c92a2a;
    --status-warning-bg: #fff9db;
    --status-warning-text: #e67700;
    --status-info-bg: #e7f5ff;
    --status-info-text: #1864ab;

    --btn-secondary-color: #495057;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--tblr-body-bg);
    overflow: hidden;
}

.page-container { width: 100%; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: linear-gradient(160deg, #1a237e 0%, #283593 100%);
    color: #ffffff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    z-index: 1030;
    display: flex;
    flex-direction: column;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
    padding: 0.85rem 1.25rem;
    margin: 0.25rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sidebar .nav-link:hover { background-color: rgba(255, 255, 255, 0.08); color: #ffffff !important; transform: translateX(4px); }
.sidebar .nav-link.active { background-color: rgba(255, 255, 255, 0.15); color: #ffffff !important; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); font-weight: 600; }
.sidebar .nav-link i, .sidebar .nav-link svg { margin-right: 0.75rem; opacity: 0.9; }

/* Main Content */
.main-content { background-color: var(--tblr-body-bg); display: flex; flex-direction: column; height: 100vh; overflow: hidden; position: relative; }
.topbar { background-color: #ffffff !important; border-bottom: 1px solid var(--tblr-card-border-color); padding: 0.75rem 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.02); z-index: 1020; }
#page-content { padding: 1.5rem; flex: 1; overflow-y: auto; overflow-x: hidden; }

/* Card */
.card { border: none; background-color: var(--tblr-card-bg); box-shadow: var(--tblr-card-shadow); border-radius: 12px; margin-bottom: 1.5rem; }
.card-header { background-color: transparent; border-bottom: 1px solid rgba(0, 0, 0, 0.03); padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 1.1rem; font-weight: 600; color: #1e293b; margin: 0; }
.card-body { padding: 1.5rem; }

/* Metrics */
.metric-card { display: flex; align-items: center; padding: 1.25rem; }
.metric-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-right: 1rem; }
.metric-value { font-size: 1.5rem; font-weight: 700; color: #111827; line-height: 1.2; }
.metric-label { font-size: 0.875rem; color: #6b7280; font-weight: 500; }

/* Table */
.table thead th { background-color: #f8fafc; color: #64748b; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; border-bottom: 1px solid #e2e8f0; padding: 1rem; }
.table td { padding: 1rem; vertical-align: middle; color: #334155; border-bottom: 1px solid #f1f5f9; }
.table-hover tbody tr:hover { background-color: #f8fafc; }

/* === Row Highlights (Approved Colors) === */
.table-row-active {
    background-color: #e0e7ff !important;
}
.table-row-active td {
    color: #1a237e !important;
    font-weight: 500;
}

.table-row-custom {
    background-color: #fffbe0 !important;
}
.table-row-custom td {
    color: #8c7300 !important;
    font-weight: 500;
}

/* Badge */
.badge-soft { padding: 0.35em 0.8em; font-size: 0.75rem; font-weight: 600; border-radius: 6px; letter-spacing: 0.02em; }
.badge-soft-success { background-color: var(--status-success-bg); color: var(--status-success-text); }
.badge-soft-danger { background-color: var(--status-danger-bg); color: var(--status-danger-text); }
.badge-soft-warning { background-color: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-soft-info { background-color: var(--status-info-bg); color: var(--status-info-text); }
.badge-soft-secondary { background-color: #e9ecef; color: #343a40; }

/* Buttons */
.btn { border-radius: 8px; font-weight: 500; padding: 0.5rem 1rem; transition: all 0.2s; }
.btn-primary { background-color: var(--tblr-primary); border-color: var(--tblr-primary); }
.btn-primary:hover { background-color: #151b60; border-color: #151b60; }

/* --- ICON VISIBILITY FIX --- */
/* Force all icons inside buttons to inherit the button's text color */
/* This solves the "white icon on white background" issue for outline buttons */
.btn i, .btn svg {
    color: inherit !important;
    opacity: 1 !important;
    font-size: 1.1em;
    vertical-align: text-bottom;
}

.btn-outline-primary { color: var(--tblr-primary); border-color: var(--tblr-primary); }
.btn-outline-primary:hover { background-color: var(--tblr-primary); color: #ffffff; }

.btn-outline-secondary { color: #64748b; border-color: #cbd5e1; }
.btn-outline-secondary:hover { background-color: #f1f5f9; color: #1e293b; border-color: #94a3b8; }

.btn-outline-danger { color: #dc3545; border-color: #dc3545; }
.btn-outline-danger:hover { background-color: #dc3545; color: #ffffff; }

/* Ghost Buttons */
.btn-ghost-secondary { color: #64748b; background: transparent; border: 1px solid transparent; }
.btn-ghost-secondary:hover { background-color: #f1f5f9; color: var(--tblr-primary); }
.btn-ghost-danger { color: #94a3b8; background: transparent; border: 1px solid transparent; }
.btn-ghost-danger:hover { background-color: #fef2f2; color: #dc2626; }

/* Logs */
#logs-container { background-color: #f8f9fa; border-radius: 0 0 12px 12px; color: #212529; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; border-top: 1px solid #dee2e6; }
#logs-container .log-line { display: block; padding: 2px 8px; border-bottom: 1px solid #e9ecef; }
#logs-container .log-info { color: #0d6efd; }
#logs-container .log-warning { color: #d97706; }
#logs-container .log-error { color: #dc3545; }
#logs-container .log-default { color: #6c757d; }

.log-toolbar-btn { color: var(--btn-secondary-color) !important; }
.log-toolbar-btn:hover { color: #000000 !important; background-color: rgba(0,0,0,0.05); }

.page-header { margin-bottom: 2rem; }
.page-pretitle { display: none !important; } 
.page-title { margin: 0; font-size: 1.5rem; font-weight: 600; color: #1e293b; }

@media (max-width: 991.98px) {
    .sidebar { width: 100%; position: fixed; top: 0; left: -100%; height: 100%; transition: left 0.3s ease; }
    .sidebar.show { left: 0; }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1025; }
    .sidebar-overlay.show { display: block; }
}