:root {
    /* Color Palette - MecPro Theme */
    --primary-color: #f97316;
    /* Orange */
    --primary-hover: #ea580c;

    /* Light Mode */
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-color: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --sidebar-bg: #FFFFFF;
    --sidebar-text: #374151;
    --topbar-bg: #FFFFFF;

    /* Status Colors */
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;

    /* Spacing */
    --sidebar-width: 220px;
    --topbar-height: 64px;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    /* Slate 900 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --text-color: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */
    --sidebar-bg: #050811;
    /* Mais escuro que o fundo */
    --sidebar-text: #cbd5e1;
    --topbar-bg: #050811;
    /* Mais escuro que o fundo */
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    /* Requested size */
    /* Prevent body scroll, use inner scroll */
}

/* Layout Structure */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    height: auto;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 24px;
    color: var(--text-color);
}

.brand-orange {
    color: var(--primary-color);
}

/* AutoTech Brand Styles */
.sidebar-brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon-box {
    width: 42px;
    height: 42px;
    background-color: rgba(249, 115, 22, 0.15);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

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

.brand-tagline {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 4px;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    /* Reduced padding */
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 2px;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9em;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(249, 115, 22, 0.1);
    /* Primary with opacity */
    color: var(--primary-color);
}

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

.user-profile {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.user-info {
    overflow: hidden;
}

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

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-color);
}

.topbar {
    height: var(--topbar-height);
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.page-title h1 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-color);
}

.page-title p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
}

.connection-status.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.connection-status.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.search-bar {
    position: relative;
}

.search-bar input {
    background-color: var(--card-bg);
    /* Or darker in dark mode */
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px 8px 36px;
    color: var(--text-color);
    width: 250px;
    font-size: 0.875rem;
}

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

/* Scrollable Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Components */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* Slightly reduced radius */
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

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

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-secondary {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

/* KPI Cards */
.kpi-card.compact {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    gap: 12px;
    height: auto;
}

/* Dashboard Standard Cards (from manual) */
.dashboard-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-header-dash {
    margin-bottom: 8px;
}

.card-header-dash h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 0;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
    margin: 2px 0;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

/* Activity List */
.activity-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 2px;
}

.activity-item.success::before {
    background-color: var(--success-color);
}

.activity-item.warning::before {
    background-color: var(--warning-color);
}

.activity-item.danger::before {
    background-color: var(--danger-color);
}

.activity-item.primary::before {
    background-color: var(--primary-color);
}

.activity-content {
    margin-left: 12px;
}

.activity-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.activity-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-time {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
    display: block;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

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

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

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-color);
    margin-right: 16px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        /* Fixed to stay on screen */
        top: 0;
        left: 0;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1100;
        /* Higher than header */
    }

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

    .mobile-toggle {
        display: block;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

    .col-hide-mobile {
        display: none;
    }

    /* Overlay background when menu is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        /* Below sidebar, above content */
        opacity: 0;
        transition: opacity 0.3s;
    }
}

/* -------------------------------------------------------------------------- */
/*                        Utility Classes (Bootstrap-like)                    */
/* -------------------------------------------------------------------------- */
.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.flex-column {
    flex-direction: column !important;
}

.pt-3 {
    padding-top: 1rem !important;
}

.pb-2 {
    padding-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border-color) !important;
}

.text-right {
    text-align: right !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.h2 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

/* -------------------------------------------------------------------------- */
/*                              Button Classes                                */
/* -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
    gap: 8px;
}

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

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

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

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

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

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

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background-color: var(--warning-color);
    /* #F59E0B */
    color: white;
    /* Contrast maybe better with black but white is standard for these */
}

.btn-warning:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    filter: brightness(95%);
}

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

.btn-info:hover {
    filter: brightness(90%);
}

/* -------------------------------------------------------------------------- */
/*                               Form Classes                                 */
/* -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 16px;
    width: 100%;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    /* Contrast inside card */
    color: var(--text-color);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    display: block;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
    /* Reset margin inside row */
}

/* -------------------------------------------------------------------------- */
/*                               Modal Styles                                 */
/* -------------------------------------------------------------------------- */
.modal-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent black */
    z-index: 2000;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--card-bg);
    margin: 40px auto;
    padding: 24px;
    width: 90%;
    max-width: 650px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger-color);
}

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

/* Connection Indicator Floating */
.connection-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

.connection-indicator.show {
    transform: translateX(-50%) translateY(0);
}

.connection-indicator.online {
    border-left: 4px solid var(--success-color);
}

.connection-indicator.offline {
    border-left: 4px solid var(--danger-color);
}

.connection-indicator i {
    font-size: 1.1rem;
}

.connection-indicator.online i {
    color: var(--success-color);
}

.connection-indicator.offline i {
    color: var(--danger-color);
}