/* Modern Layout Styles - Inspired by jetimob */

:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e40af;
    --secondary-color: #3b82f6;
    --sidebar-bg: #f8f9fa;
    --sidebar-active: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f3f4f6;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Header */
.modern-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.logo-container i {
    font-size: 20px;
}

.search-container {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

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

.company-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.header-icon {
    position: relative;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.header-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

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

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info i {
    font-size: 12px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-profile.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: #f3f4f6;
}

.user-dropdown a i {
    width: 16px;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Sidebar */
.modern-sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    width: 240px;
    height: calc(100vh - 64px);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.modern-sidebar.collapsed {
    width: 70px;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

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

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--sidebar-active);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--sidebar-active);
}

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

.modern-sidebar.collapsed .nav-text {
    display: none;
}

.modern-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

/* Submenu Styles */
.nav-item-with-submenu {
    position: relative;
}

.nav-item-toggle {
    cursor: pointer;
}

.nav-chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-chevron.rotated {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(59, 130, 246, 0.05);
}

.nav-submenu.expanded {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 10px 50px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-subitem:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}

.nav-subitem.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 500;
}

.nav-subitem i {
    font-size: 10px;
    opacity: 0.5;
}

.modern-sidebar.collapsed .nav-submenu {
    display: none;
}

.modern-sidebar.collapsed .nav-chevron {
    display: none;
}

/* Main Content */
.modern-content {
    margin-left: 240px;
    margin-top: 64px;
    padding: 24px;
    min-height: calc(100vh - 64px);
    transition: all 0.3s ease;
}

.modern-content.expanded {
    margin-left: 70px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--sidebar-active);
}

.breadcrumbs .separator {
    color: var(--text-secondary);
}

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

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

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

.page-title i {
    color: var(--sidebar-active);
}

/* Cards */
.modern-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

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

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

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

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.metric-title i {
    color: var(--sidebar-active);
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0;
}

.metric-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

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

.legend-dot.green {
    background: var(--success-color);
}

.legend-dot.blue {
    background: var(--info-color);
}

.legend-dot.orange {
    background: var(--warning-color);
}

.legend-dot.red {
    background: var(--danger-color);
}

.metric-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.metric-column {
    text-align: center;
}

.metric-column-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-column-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Buttons */
.btn-modern {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

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

.btn-modern-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-modern-secondary:hover {
    background: #f9fafb;
    border-color: var(--sidebar-active);
    color: var(--sidebar-active);
}

/* Filters Section */
.filters-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

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

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-input,
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--sidebar-active);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

/* Tables */
.modern-table-container {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

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

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.modern-table thead {
    background: #f9fafb;
}

.modern-table th {
    padding: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modern-table tbody tr:hover {
    background: #f9fafb;
}

/* Forms */
.modern-form {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

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

.form-control {
    width: 100%;
    height: auto;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: var(--sidebar-active);
    color: white;
}

/* Glyphicon to Font Awesome compatibility */
.glyphicon {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.glyphicon-home::before { content: "\f015"; }
.glyphicon-user::before { content: "\f007"; }
.glyphicon-edit::before { content: "\f044"; }
.glyphicon-eye-open::before { content: "\f06e"; }
.glyphicon-plus::before { content: "\f067"; }
.glyphicon-remove::before { content: "\f00d"; }
.glyphicon-ok::before { content: "\f00c"; }
.glyphicon-remove-circle::before { content: "\f057"; }
.glyphicon-ok-circle::before { content: "\f058"; }
.glyphicon-chevron-left::before { content: "\f053"; }
.glyphicon-chevron-right::before { content: "\f054"; }
.glyphicon-chevron-up::before { content: "\f077"; }
.glyphicon-chevron-down::before { content: "\f078"; }
.glyphicon-arrow-left::before { content: "\f060"; }
.glyphicon-arrow-right::before { content: "\f061"; }
.glyphicon-phone::before { content: "\f095"; }
.glyphicon-phone-alt::before { content: "\f879"; }
.glyphicon-envelope::before { content: "\f0e0"; }
.glyphicon-calendar::before { content: "\f073"; }
.glyphicon-file::before { content: "\f15b"; }
.glyphicon-folder::before { content: "\f07b"; }
.glyphicon-cog::before { content: "\f013"; }
.glyphicon-warning-sign::before { content: "\f071"; }
.glyphicon-trash::before { content: "\f2ed"; }
.glyphicon-search::before { content: "\f002"; }
.glyphicon-stats::before { content: "\f080"; }
.glyphicon-signal::before { content: "\f012"; }
.glyphicon-briefcase::before { content: "\f0b1"; }
.glyphicon-th-large::before { content: "\f009"; }
.glyphicon-usd::before { content: "\f155"; }
.glyphicon-shopping-cart::before { content: "\f07a"; }
.glyphicon-time::before { content: "\f017"; }
.glyphicon-repeat::before { content: "\f01e"; }
.glyphicon-check::before { content: "\f00c"; }
.glyphicon-map-marker::before { content: "\f3c5"; }

/* Filter Tags */
.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.filter-tag button {
    opacity: 0.7;
}

.filter-tag button:hover {
    opacity: 1;
}

.active-filters {
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .modern-sidebar {
        transform: translateX(-100%);
    }
    
    .modern-sidebar.collapsed {
        transform: translateX(0);
    }
    
    .modern-content {
        margin-left: 0;
    }
    
    .modern-content.expanded {
        margin-left: 0;
    }
    
    .header-left {
        gap: 12px;
    }
    
    .search-container {
        display: none;
    }
    
    .company-name {
        display: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Form Styles */
.modern-form {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

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

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

.form-control {
    width: 100%;
    height: auto;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: var(--sidebar-active);
    color: white;
}

/* Legacy Bootstrap button compatibility */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

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

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

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

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

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

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

.btn-default,
.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

/* ==========================================================================
   Selects legíveis (corrige texto cortado do Bootstrap height:34px + padding)
   ========================================================================== */
select.form-control,
select.filter-select,
select.filter-input,
.modern-card select,
.filters-section select,
form select {
    height: 44px !important;
    min-height: 44px !important;
    max-height: none !important;
    line-height: 42px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 12px !important;
    padding-right: 32px !important;
    font-size: 14px !important;
    color: #111827 !important;
    background-color: #fff !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4 0.6L6 5.2 10.6 0.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

select.form-control option,
select.filter-select option,
form select option {
    color: #111827;
    background: #fff;
    line-height: 1.4;
    padding: 8px;
}

