/* VEMP - Videotron Environment Monitoring Platform
   Custom Styles
   ============================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary: #1890ff;
    --primary-hover: #096dd9;
    --primary-active: #0050b3;
    --primary-dark: #003a8c;

    /* Status Colors */
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #1890ff;
    --offline: #8c8c8c;

    /* Neutral Colors */
    --white: #ffffff;
    --bg-light: #f5f7fa;
    --bg-card: #ffffff;
    --border: #e8e8e8;
    --divider: #f0f0f0;

    /* Text Colors */
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-muted: #8c8c8c;
    --text-light: #bfbfbf;

    /* Chart Colors */
    --chart-1: #1890ff;
    --chart-2: #52c41a;
    --chart-3: #faad14;
    --chart-4: #ff4d4f;
    --chart-5: #722ed1;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* Sidebar */
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

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

/* ==============================================
   LAYOUT
   ============================================== */

/* Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #001529 0%, #002140 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

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

.sidebar-header {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(24, 144, 255, 0.15);
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-logo i {
    font-size: 22px;
    color: var(--primary);
}

.sidebar-logo span {
    white-space: nowrap;
}

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

/* Sidebar Brand */
.sidebar-brand {
    margin-left: 12px;
}

.sidebar-brand h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
}

.sidebar-brand small {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.5px;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

/* Nav Link (used in HTML) */
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.2s;
    cursor: pointer;
    gap: 12px;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.active {
    color: var(--white);
    background: var(--primary);
    border-radius: 0;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    white-space: nowrap;
}

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

/* Nav Badge */
.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.nav-badge.bg-danger {
    background: var(--danger) !important;
}

.sidebar.collapsed .nav-badge {
    display: none;
}

/* Nav Item (alternative class) */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.2s;
    cursor: pointer;
    gap: 12px;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--white);
    background: var(--primary);
}

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

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

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

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

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

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--offline);
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.warning {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-indicator.offline {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

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

/* Header */
.main-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: var(--bg-light);
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb-nav a {
    color: var(--text-muted);
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-nav .current {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
}

.header-search input {
    width: 240px;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    position: relative;
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.header-btn .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-dropdown:hover {
    background: var(--bg-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    padding: 24px;
}

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

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==============================================
   CARDS
   ============================================== */

.card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
    border-radius: 0 0 8px 8px;
}

/* Stat Cards */
.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card-icon.primary {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary);
}

.stat-card-icon.success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success);
}

.stat-card-icon.warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning);
}

.stat-card-icon.danger {
    background: rgba(255, 77, 79, 0.1);
    color: var(--danger);
}

.stat-card-trend {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
}

.stat-card-trend.up {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success);
}

.stat-card-trend.down {
    background: rgba(255, 77, 79, 0.1);
    color: var(--danger);
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* Stat Card - Alternative structure (used in HTML) */
.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--white);
}

.stat-icon.bg-primary {
    background: var(--primary);
}

.stat-icon.bg-success {
    background: var(--success);
}

.stat-icon.bg-warning {
    background: var(--warning);
}

.stat-icon.bg-danger {
    background: var(--danger);
}

.stat-icon.bg-info {
    background: var(--info);
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.stat-info p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

.stat-info small {
    font-size: 12px;
    color: var(--success);
    display: block;
    margin-top: 8px;
}

.stat-info small.text-danger {
    color: var(--danger);
}

/* KPI Icon (used in analytics page) */
.kpi-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
}

.kpi-icon.bg-success {
    background: rgba(82, 196, 26, 0.15) !important;
}

.kpi-icon.bg-primary {
    background: rgba(24, 144, 255, 0.15) !important;
}

.kpi-icon.bg-warning {
    background: rgba(250, 173, 20, 0.15) !important;
}

.kpi-icon.bg-danger {
    background: rgba(255, 77, 79, 0.15) !important;
}

.kpi-icon.bg-info {
    background: rgba(24, 144, 255, 0.15) !important;
}

.kpi-icon i {
    font-size: 24px !important;
}

/* Gauge Cards */
.gauge-card {
    text-align: center;
    padding: 10px;
}

.gauge-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: -10px;
    text-align: center;
}

/* ==============================================
   STATUS INDICATORS
   ============================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

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

.status-badge.online {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success);
}

.status-badge.online .status-dot {
    background: var(--success);
}

.status-badge.warning {
    background: rgba(250, 173, 20, 0.1);
    color: #d48806;
}

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

.status-badge.offline,
.status-badge.critical {
    background: rgba(255, 77, 79, 0.1);
    color: var(--danger);
}

.status-badge.offline .status-dot,
.status-badge.critical .status-dot {
    background: var(--danger);
}

.status-badge.unknown {
    background: rgba(140, 140, 140, 0.1);
    color: var(--offline);
}

.status-badge.unknown .status-dot {
    background: var(--offline);
}

/* ==============================================
   TABLES
   ============================================== */

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.data-table .device-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-table .device-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary);
}

.data-table .device-name {
    font-weight: 500;
    color: var(--text-primary);
}

.data-table .device-model {
    font-size: 12px;
    color: var(--text-muted);
}

.data-table .actions-cell {
    white-space: nowrap;
}

.data-table .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.data-table .btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Action Buttons in Table - Consistent Style */
.btn-group-sm .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border) !important;
    background: var(--white) !important;
}

.btn-group-sm .btn.btn-outline-primary {
    color: var(--primary);
}

.btn-group-sm .btn.btn-outline-secondary {
    color: var(--text-secondary);
}

.btn-group-sm .btn.btn-outline-danger {
    color: var(--danger);
}

.btn-group-sm .btn.btn-outline-success {
    color: var(--success);
}

.btn-group-sm .btn:hover {
    background: var(--bg-light) !important;
    border-color: var(--border) !important;
}

.btn-group-sm .btn.btn-outline-primary:hover {
    color: var(--primary-hover);
    border-color: var(--primary) !important;
}

.btn-group-sm .btn.btn-outline-danger:hover {
    color: #cf1322;
    border-color: var(--danger) !important;
}

.btn-group-sm .btn.btn-outline-success:hover {
    color: #389e0d;
    border-color: var(--success) !important;
}

/* ==============================================
   ALERTS
   ============================================== */

.alert-item {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s;
}

.alert-item:hover {
    box-shadow: var(--shadow);
}

.alert-item.critical {
    border-left: 4px solid var(--danger);
}

.alert-item.warning {
    border-left: 4px solid var(--warning);
}

.alert-item.info {
    border-left: 4px solid var(--info);
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.alert-item.critical .alert-icon {
    background: rgba(255, 77, 79, 0.1);
    color: var(--danger);
}

.alert-item.warning .alert-icon {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning);
}

.alert-item.info .alert-icon {
    background: rgba(24, 144, 255, 0.1);
    color: var(--info);
}

.alert-content {
    flex: 1;
    min-width: 0;
}

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

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
}

.alert-time {
    font-size: 12px;
    color: var(--text-muted);
}

.alert-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.alert-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.alert-meta i {
    margin-right: 4px;
}

.alert-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ==============================================
   CHARTS
   ============================================== */

.chart-container {
    height: 300px;
    width: 100%;
}

.chart-container.small {
    height: 200px;
}

.chart-container.large {
    height: 400px;
}

/* ==============================================
   FORMS
   ============================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-text.error {
    color: var(--danger);
}

/* Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: 6px 0 0 6px;
}

.input-group-text {
    padding: 10px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
}

/* ==============================================
   BUTTONS
   ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

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

.btn-success:hover {
    background: #389e0d;
}

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

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

.btn-danger:hover {
    background: #cf1322;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

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

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

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

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

.btn-ghost:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ==============================================
   MODALS
   ============================================== */

.modal-xl {
    max-width: 1000px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==============================================
   TABS
   ============================================== */

.nav-tabs-custom {
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.nav-tabs-custom .nav-link {
    padding: 12px 20px;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary);
}

.nav-tabs-custom .nav-link.active {
    color: var(--primary);
    background: none;
    border: none;
}

.nav-tabs-custom .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* ==============================================
   ENVIRONMENT METRICS
   ============================================== */

.metric-card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
}

.metric-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.metric-status {
    font-size: 12px;
    margin-top: 8px;
}

.metric-card.temp .metric-icon { color: #ff7a45; }
.metric-card.humidity .metric-icon { color: #36cfc9; }
.metric-card.brightness .metric-icon { color: #ffc53d; }
.metric-card.power .metric-icon { color: #9254de; }
.metric-card.smoke .metric-icon { color: #8c8c8c; }

/* ==============================================
   DEVICE TREE
   ============================================== */

.device-tree {
    font-size: 14px;
}

.device-tree-item {
    padding: 8px 0;
    padding-left: 20px;
    border-left: 1px solid var(--border);
    position: relative;
}

.device-tree-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    width: 16px;
    border-top: 1px solid var(--border);
}

.device-tree-item:last-child {
    border-left-color: transparent;
}

.device-tree-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.device-tree-node:hover {
    background: var(--bg-light);
}

.device-tree-node i {
    color: var(--primary);
}

.device-tree-status {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==============================================
   MAP PLACEHOLDER
   ============================================== */

.map-container {
    height: 400px;
    background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.map-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--white);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 1;
}

.map-marker:hover {
    transform: scale(1.2);
}

.map-marker.online { background: var(--success); }
.map-marker.warning { background: var(--warning); }
.map-marker.critical { background: var(--danger); }
.map-marker.offline { background: var(--offline); }

.map-legend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-size: 12px;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

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

.map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ==============================================
   LOGIN PAGE
   ============================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #001529 0%, #003a8c 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 12px;
    color: var(--text-primary);
}

.login-logo p {
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-forgot {
    font-size: 14px;
    color: var(--primary);
}

.login-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    background: var(--white);
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
}

/* ==============================================
   SETTINGS
   ============================================== */

.settings-sidebar {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.settings-menu-item:last-child {
    border-bottom: none;
}

.settings-menu-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.settings-menu-item.active {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.settings-menu-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* ==============================================
   PAGINATION
   ============================================== */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 4px;
}

.page-link {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.page-item.disabled .page-link {
    color: var(--text-light);
    cursor: not-allowed;
}

/* ==============================================
   UTILITIES
   ============================================== */

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-light { background-color: var(--bg-light) !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 16px !important; }
.gap-4 { gap: 24px !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }

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

@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .sidebar-logo span,
    .sidebar .nav-section-title,
    .sidebar .nav-item span,
    .sidebar .nav-item .badge {
        display: none;
    }

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.show .sidebar-logo span,
    .sidebar.show .nav-section-title,
    .sidebar.show .nav-item span,
    .sidebar.show .nav-item .badge {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .header-search {
        display: none;
    }

    .user-info {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .stat-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 16px;
    }

    .stat-cards-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: 16px;
    }
}

/* Grid for stat cards */
.stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .stat-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stat-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Receiving Cards Grid */
.receiving-cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

@media (max-width: 992px) {
    .receiving-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 576px) {
    .receiving-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.rc-card {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.rc-card .rc-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
}

.rc-card .rc-temp {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.rc-card .rc-voltage {
    font-size: 12px;
    color: var(--text-muted);
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .form-control,
.filter-bar .form-select {
    width: auto;
    min-width: 150px;
}

.filter-bar .search-box {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    position: relative;
}

.filter-bar .search-box input {
    padding-left: 36px;
}

.filter-bar .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Time Range Buttons */
.time-range-btns {
    display: flex;
    gap: 4px;
}

.time-range-btns .btn {
    padding: 6px 14px;
    font-size: 13px;
}

/* Progress Bars */
.progress-thin {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-light);
    overflow: hidden;
}

.progress-thin .progress-bar {
    border-radius: 3px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(24, 144, 255, 0.05);
}

.quick-action-btn i {
    font-size: 24px;
}

.quick-action-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* Integration Cards */
.integration-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.integration-card:hover {
    box-shadow: var(--shadow);
}

.integration-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary);
}

.integration-info {
    flex: 1;
}

.integration-name {
    font-weight: 600;
    color: var(--text-primary);
}

.integration-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.integration-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tooltip custom */
.tooltip-custom {
    position: relative;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
}

.tooltip-custom:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}
