/* ==========================================================================
   DLMS Ingestion Dashboard Premium Styling (Glassmorphism & Dark Mode)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #0B0F19;
    --bg-card: rgba(22, 28, 45, 0.45);
    --bg-card-hover: rgba(22, 28, 45, 0.7);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    /* Accents (HSL Tailored) */
    --primary: #4F46E5;       /* Indigo */
    --primary-light: #818CF8;
    --primary-glow: rgba(79, 70, 229, 0.15);
    
    --success: #10B981;       /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.15);
    
    --warning: #F59E0B;       /* Amber */
    --warning-glow: rgba(245, 158, 11, 0.15);
    
    --danger: #EF4444;        /* Rose/Red */
    --danger-glow: rgba(239, 68, 68, 0.15);
    
    --info: #06B6D4;          /* Cyan */
    --info-glow: rgba(6, 182, 212, 0.15);
    
    /* Dimensions & Miscellaneous */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 20%, rgba(79, 70, 229, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(6, 182, 212, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(239, 68, 68, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout Structure */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(11, 15, 25, 0.85);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-card);
}

.brand-icon {
    color: var(--primary-light);
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px var(--primary-light));
}

.brand-text h2 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFF 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.sidebar-menu {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item i {
    width: 20px;
    height: 20px;
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: #FFF;
    background: linear-gradient(135deg, var(--primary) 0%, rgba(79, 70, 229, 0.6) 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-card);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}

.status-details {
    display: flex;
    flex-direction: column;
}

.status-title {
    font-size: 0.8rem;
    font-weight: 600;
}

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

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: var(--header-height);
    background-color: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-card);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    padding: 8px 16px;
    border-radius: 20px;
    width: 320px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary-light);
    background-color: rgba(255, 255, 255, 0.08);
}

.header-search i {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.header-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    width: 100%;
}

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

.header-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.notification-bell:hover {
    color: var(--text-primary);
}

.bell-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-main);
    display: none;
}

.bell-dot.active {
    display: block;
}

.divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-card);
}

.profile-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.profile-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.profile-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Content Body */
.content-body {
    padding: 32px;
    flex-grow: 1;
}

.content-view {
    display: none;
}

.content-view.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Glass Panels & Cards */
.glass {
    background-color: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.glass:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-card-hover);
}

/* Welcome Banner */
.welcome-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
    border: 1px solid rgba(79, 70, 229, 0.2);
    padding: 24px 32px;
    border-radius: var(--radius-lg);
}

.welcome-text h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #FFF 0%, #CCD6F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.welcome-time {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-light);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stats-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: transparent;
    transition: var(--transition);
}

.stats-card:hover::before {
    height: 100%;
}

.stats-card:nth-child(1):hover::before { background-color: var(--info); }
.stats-card:nth-child(2):hover::before { background-color: var(--success); }
.stats-card:nth-child(3):hover::before { background-color: var(--danger); }
.stats-card:nth-child(4):hover::before { background-color: var(--warning); }

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon i {
    width: 20px;
    height: 20px;
}

.icon-blue { background-color: var(--info-glow); color: var(--info); }
.icon-green { background-color: var(--success-glow); color: var(--success); }
.icon-red { background-color: var(--danger-glow); color: var(--danger); }
.icon-yellow { background-color: var(--warning-glow); color: var(--warning); }

.stats-card h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    font-family: var(--font-heading);
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.footer-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.footer-trend i {
    width: 14px;
    height: 14px;
}

.footer-trend.positive { color: var(--success); }
.footer-trend.negative { color: var(--danger); }
.footer-trend.warning { color: var(--warning); }

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

/* Split Sections and Panels */
.split-section {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.flex-1 { flex: 1 1 300px; }
.flex-2 { flex: 2 1 600px; }

.panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

/* Ingestion Live Feed */
.ingestion-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.feed-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-card-hover);
}

.feed-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-glow);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-icon i {
    width: 18px;
    height: 18px;
}

.feed-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.feed-details .meter-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.feed-details .meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.feed-records-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
}

.live-pulse {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--success);
    background-color: var(--success-glow);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Red Pulsing Alerts */
.border-red-glass {
    border-color: rgba(239, 68, 68, 0.3) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.05);
}

.pulse-badge-red {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--danger);
    background-color: var(--danger-glow);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.pulse-dot-red {
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 50%;
    animation: pulse-red 1.5s infinite;
}

/* Tables styling */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.small-table { max-height: 250px; overflow-y: auto; }
.large-table { min-height: 350px; }

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

.table th, .table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
    background-color: rgba(0, 0, 0, 0.15);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.table td {
    color: var(--text-primary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid transparent;
}

.badge-success { background-color: var(--success-glow); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.badge-danger { background-color: var(--danger-glow); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-warning { background-color: var(--warning-glow); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-info { background-color: var(--info-glow); color: var(--info); border-color: rgba(6, 182, 212, 0.2); }

.text-large { font-size: 0.9rem; padding: 6px 14px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    outline: none;
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 6px; }

.btn-primary {
    background-color: var(--primary);
    color: #FFF;
}
.btn-primary:hover {
    background-color: #4338CA;
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background-color: var(--success);
    color: #FFF;
}
.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: none;
    border-color: var(--border-card-hover);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-outline-danger {
    background: none;
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger);
}
.btn-outline-danger:hover {
    background-color: var(--danger);
    color: #FFF;
}

.btn-outline-light {
    background: none;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}
.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Detail Modal Panel (Registry Detail View) */
.meter-detail-panel {
    animation: slideUp 0.4s ease-out;
}

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

.detail-title-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-title-block h2 {
    font-size: 1.6rem;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.meta-card {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.meta-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

/* Charts grid */
.charts-container-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

@media(max-width: 600px) {
    .charts-container-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    padding: 20px;
}

.chart-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Analysis details panel */
.analysis-stats-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analysis-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
}

.analysis-row .lbl {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.analysis-row .val {
    font-family: var(--font-heading);
    font-size: 1.05rem;
}

.font-bold { font-weight: 700; }
.text-blue { color: var(--info); }
.text-yellow { color: var(--warning); }

/* Report Filters Panel styling */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-field label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-field select, .filter-field input {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-card);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: var(--transition);
}

.filter-field select:focus, .filter-field input:focus {
    border-color: var(--primary-light);
    background-color: rgba(0, 0, 0, 0.3);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-card);
    padding-top: 16px;
}

.mt-24 { margin-top: 24px; }

/* Logic Rules Cards */
.logic-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.rule-card {
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
}

.rule-card h4 {
    font-size: 0.9rem;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.rule-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Custom Scrollbar for modern look */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
