/* ==========================================================================
   LIDER IT Consulting - Maintenance Hub Corporate Theme
   Official Brand Reference: https://liderit.es/
   Palette Extracted:
     - Primary Brand Accent: #ED8B00 (LIDER IT Orange)
     - Primary Hover: #D47C00 / Active: #BA6D00
     - Dark Structure & Headings: #1E2229 / #23272F
     - Body Text: #2B2F38 / Secondary Text: #55585D / Muted: #787878
     - Canvas Background: #F8F9FA / Card Surface: #FFFFFF / Elevated: #F1F3F5
     - Neutral Borders: #E5E7EB (liderit #E5E5E5)
     - Functional Semantics: Green #16A34A, Amber #D97706, Red #DC2626
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap');

:root {
    /* ----------------------------------------------------------------------
       LIDER IT Corporate Palette
       ---------------------------------------------------------------------- */
    --brand-primary: #ED8B00;
    --brand-primary-hover: #D47C00;
    --brand-primary-active: #BA6D00;
    --brand-primary-light: #FFF7ED;
    --brand-primary-subtle: #FED7AA;
    --brand-primary-rgb: 237, 139, 0;

    /* Estructura Oscura y Tipografía de Alto Contraste */
    --brand-dark: #1E2229;
    --brand-dark-elevated: #2B2F38;
    --brand-dark-sidebar: #191D24;
    --brand-text: #23272F;
    --brand-text-secondary: #55585D;
    --brand-muted: #787878;

    /* Superficies y Fondos Claros */
    --bg-base: #F8F9FB;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #F3F4F6;
    --bg-surface-hover: #F9FAFB;
    --bg-sidebar: #191D24;

    /* Bordes y Líneas Divisorias */
    --border-subtle: #E5E7EB;
    --border-default: #E2E8F0;
    --border-highlight: #ED8B00;

    /* Tipografía */
    --text-primary: #23272F;
    --text-secondary: #55585D;
    --text-muted: #787878;
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Estados Operativos Semánticos */
    --status-success: #16A34A;
    --status-success-bg: #DCFCE7;
    --status-success-text: #15803D;

    --status-warning: #D97706;
    --status-warning-bg: #FEF3C7;
    --status-warning-text: #B45309;

    --status-danger: #DC2626;
    --status-danger-bg: #FEE2E2;
    --status-danger-text: #991B1B;

    --status-info: #4B5563;
    --status-info-bg: #F3F4F6;
    --status-info-text: #374151;

    /* Dimensiones y Radios */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, strong, th {
    font-family: var(--font-heading);
    color: var(--brand-text);
}

/* --------------------------------------------------------------------------
   Layout Structure: Sidebar + Workspace
   -------------------------------------------------------------------------- */
.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid #282E38;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid #282E38;
    text-decoration: none;
    color: #FFFFFF;
    background-color: #14171D;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ED8B00, #D47C00);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(237, 139, 0, 0.4);
    letter-spacing: -0.02em;
}

.sidebar-brand-text {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #FFFFFF;
}

.sidebar-brand-text span {
    color: var(--brand-primary);
}

.sidebar-brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background-color: rgba(237, 139, 0, 0.2);
    color: var(--brand-primary);
    border: 1px solid rgba(237, 139, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section-label {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #787878;
    font-weight: 700;
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: #A0AEC0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-link:hover {
    color: #FFFFFF;
    background-color: #242933;
}

.sidebar-link.active {
    color: #FFFFFF;
    background-color: rgba(237, 139, 0, 0.15);
    border-left: 3px solid var(--brand-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-weight: 600;
}

.sidebar-link.active svg {
    color: var(--brand-primary);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #282E38;
    background-color: #14171D;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    background-color: #1E2229;
    border: 1px solid #282E38;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ED8B00, #BA6D00);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: #FFFFFF;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--brand-primary);
    text-transform: uppercase;
    font-weight: 600;
}

.logout-btn {
    background: transparent;
    border: none;
    color: #787878;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
}

.logout-btn:hover {
    color: var(--status-danger);
}

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

.top-navbar {
    height: var(--header-height);
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.top-nav-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rmm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    background-color: #F8F9FA;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--status-success);
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
}

.status-dot.offline {
    background-color: var(--status-danger);
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

.workspace-content {
    flex: 1;
    padding: 2rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   KPI Stats Grid (Dashboard)
   -------------------------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-box {
    background-color: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.kpi-box:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.kpi-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F8F9FA;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--brand-text);
}

.kpi-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   Cards & Content Containers
   -------------------------------------------------------------------------- */
.content-card {
    background-color: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.card-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-title svg {
    color: var(--brand-primary);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background-color: #FFFFFF;
}

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

.data-table th {
    background-color: #F8F9FA;
    color: var(--brand-text);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.15rem;
    border-bottom: 2px solid var(--border-subtle);
}

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

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

.data-table tr:hover td {
    background-color: #F9FAFB;
}

/* --------------------------------------------------------------------------
   Buttons & UI Elements
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    box-shadow: 0 4px 12px rgba(237, 139, 0, 0.35);
}

.btn-maintenance {
    background-color: var(--brand-primary);
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 8px rgba(237, 139, 0, 0.3);
    border-color: var(--brand-primary);
}

.btn-maintenance:hover {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    box-shadow: 0 4px 14px rgba(237, 139, 0, 0.45);
    transform: translateY(-1px);
}

.btn-download-pdf {
    background-color: #1E2229;
    color: #FFFFFF;
    border: 1px solid #1E2229;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.65rem 1.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: var(--shadow-sm);
}

.btn-download-pdf:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(237, 139, 0, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #FFFFFF;
    border-color: var(--border-default);
    color: var(--brand-text);
}

.btn-secondary:hover {
    background-color: #F8F9FA;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-danger {
    background-color: var(--status-danger);
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #B91C1C;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-online, .badge-success, .badge-ok {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
    border: 1px solid rgba(22, 163, 74, 0.3);
}

.badge-offline, .badge-danger, .badge-error {
    background-color: var(--status-danger-bg);
    color: var(--status-danger-text);
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.badge-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.badge-running {
    background-color: #FFF7ED;
    color: var(--brand-primary);
    border: 1px solid rgba(237, 139, 0, 0.35);
}

.badge-info {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
    border: 1px solid rgba(75, 85, 99, 0.25);
}

.badge-pending {
    background-color: #F3F4F6;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Progress Bars
   -------------------------------------------------------------------------- */
.progress-container {
    width: 100%;
    background-color: #F3F4F6;
    border-radius: 9999px;
    height: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ED8B00, #F59E0B);
    transition: width 0.4s ease;
    border-radius: 9999px;
}

/* --------------------------------------------------------------------------
   Alerts & Notifications
   -------------------------------------------------------------------------- */
.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
    border: 1px solid rgba(22, 163, 74, 0.35);
}

.alert-danger {
    background-color: var(--status-danger-bg);
    color: var(--status-danger-text);
    border: 1px solid rgba(220, 38, 38, 0.35);
}

.alert-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
    border: 1px solid rgba(217, 119, 6, 0.35);
}

/* --------------------------------------------------------------------------
   Login Screen
   -------------------------------------------------------------------------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #F8F9FA;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-top: 5px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    padding: 2.75rem 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #ED8B00, #D47C00);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 1rem;
    box-shadow: 0 4px 14px rgba(237, 139, 0, 0.35);
}

.login-brand-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
    margin-bottom: 0.25rem;
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-text);
}

.login-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-text);
    margin-bottom: 0.4rem;
}

.form-input, .form-control {
    width: 100%;
    padding: 0.7rem 0.95rem;
    background-color: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(237, 139, 0, 0.2);
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-brand-text, .sidebar-section-label, .sidebar-link span, .user-info, .sidebar-brand-badge {
        display: none;
    }
    .main-workspace {
        margin-left: 70px;
    }
    .sidebar-brand {
        padding: 0;
        justify-content: center;
    }
    .sidebar-link {
        justify-content: center;
        padding: 0.75rem 0;
    }
}
