/* ============================================
   SIGCOPRO - INDUSTRIAL MONITORING SYSTEM
   Modern Industrial Dashboard Theme
   ============================================ */

/* CSS Variables - Industrial Theme */
:root {
    /* Primary Colors - Italcol Corporate */
    --primary-dark: #1a472a;
    --primary: #2d6a4f;
    --primary-light: #40916c;
    --accent: #f77f00;
    --accent-light: #fcbf49;
    --accent-dark: #d62828;
    
    /* Neutral Colors */
    --bg-dark: #0d1117;
    --bg-primary: #161b22;
    --bg-secondary: #21262d;
    --bg-tertiary: #30363d;
    --bg-card: #1c2128;
    
    /* Text Colors */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    /* Status Colors */
    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.15);
    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.15);
    --danger: #f85149;
    --danger-bg: rgba(248, 81, 73, 0.15);
    --info: #58a6ff;
    --info-bg: rgba(88, 166, 255, 0.15);
    
    /* Cell Colors - Matching WPF */
    --cell-default: #d9e1f2;
    --cell-red: #ff4f4f;
    --cell-yellow: #ffff00;
    --cell-green: #92d050;
    --cell-blue: #2dc6ff;
    --cell-summary: #fff2cc;
    
    /* Spacing */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
    
    /* Borders */
    --border-color: #30363d;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   APP CONTAINER & LAYOUT
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-dark);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-normal);
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-icon i {
    font-size: 1.5rem;
    color: white;
}

.logo-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-collapsed .logo-text {
    display: none;
}

.sidebar-toggle {
    background: var(--bg-tertiary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
}

.sidebar-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-collapsed .nav-section-title {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    margin: 0.125rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item i {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.nav-item span {
    white-space: nowrap;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.875rem;
    margin: 0.125rem 0.5rem;
}

.sidebar-collapsed .nav-item span {
    display: none;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.connection-status.connected {
    color: var(--success);
}

.connection-status.connected i {
    animation: pulse 2s infinite;
}

.connection-status.disconnected {
    color: var(--danger);
}

.sidebar-collapsed .connection-status span {
    display: none;
}

.sidebar-collapsed .connection-status {
    justify-content: center;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.breadcrumb i {
    color: var(--primary-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-clock,
.header-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.header-clock {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.header-clock i {
    color: var(--accent);
}

.btn-refresh {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-refresh:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-refresh i.rotating {
    animation: spin 1s linear infinite;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 1.5rem;
    overflow-x: auto;
}

/* ============================================
   PRODUCTION TABLE STYLES
   ============================================ */

.production-container {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.production-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--accent);
}

.production-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.production-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.production-title-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.production-title-icon i {
    font-size: 1.5rem;
    color: white;
}

.production-meta {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.meta-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta-value {
    font-size: 1rem;
    color: white;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Info Bar */
.info-bar {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-tertiary);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

.info-value.highlight {
    background: var(--info-bg);
    color: var(--info);
}

/* Data Table */
.production-table-wrapper {
    overflow-x: auto;
    padding: 0;
}

.production-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.production-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.5rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.production-table th:first-child {
    border-left: none;
}

.production-table th.section-header {
    background: linear-gradient(90deg, var(--info-bg) 0%, transparent 100%);
    color: var(--info);
}

.production-table td {
    padding: 0.625rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    transition: background var(--transition-fast);
    color: #1a1a1a;
}

.production-table tbody tr:hover td {
    filter: brightness(0.95);
}

/* Cell Colors */
.cell-default {
    background: var(--cell-default);
}

.cell-red {
    background: var(--cell-red) !important;
}

.cell-yellow {
    background: var(--cell-yellow) !important;
}

.cell-green {
    background: var(--cell-green) !important;
}

.cell-blue {
    background: var(--cell-blue) !important;
}

.cell-summary {
    background: var(--cell-summary) !important;
    font-weight: 800 !important;
}

.cell-hora {
    background: var(--cell-default);
    font-weight: 700;
}

/* Summary Row */
.production-table tbody tr.summary-row td {
    background: var(--cell-summary);
    font-weight: 800;
    font-size: 0.9rem;
    border-top: 3px solid var(--border-color);
}

/* Observations Column */
.cell-observations {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
}

/* ============================================
   LOADING & STATUS INDICATORS
   ============================================ */

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.status-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============================================
   NOT FOUND PAGE
   ============================================ */

.not-found-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
}

.not-found-content {
    text-align: center;
}

.not-found-content i {
    font-size: 4rem;
    color: var(--warning);
    margin-bottom: 1rem;
}

.not-found-content h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.not-found-content p {
    color: var(--text-secondary);
    margin: 1rem 0 2rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-back:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* ============================================
   BLAZOR ERROR UI
   ============================================ */

#blazor-error-ui {
    background: var(--danger);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .production-table {
        font-size: 0.75rem;
    }
    
    .production-table th,
    .production-table td {
        padding: 0.5rem 0.375rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-date {
        display: none;
    }
    
    .production-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .production-meta {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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