body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background-color: #f5f6fa;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}
.card-dimmed {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

/* ====== Layout ====== */
.page {
    position: relative;
    display: flex;
    flex-direction: row;
    height: 100vh;
}

/* ====== Sidebar ====== */
.sidebar {
    background-color: #1f2937;
    color: #fff;
    width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 1rem 0.75rem;
    border-right: 1px solid #2d3748;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    color: #fff;
    font-size: 1.25rem;
    margin: 0;
    padding: 0.5rem 0;
}

.sidebar .nav-link {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: #374151;
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: #4C6EF5;
    color: #fff;
}

.sidebar .nav-section {
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 600;
    padding-left: 12px;
}

/* ====== Main Content ====== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.top-row {
    background-color: #4C6EF5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    height: 60px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* ====== Content ====== */
.content {
    flex: 1;
    width: 100%;
    padding: clamp(12px, 1.8vw, 24px);
    /* Permitir rolagem vertical para não cortar conteúdo longo */
    overflow-y: auto;
    background-color: #f8f9fc;
}

.page-container,
.main-content,
.page-content {
    width: 100%;
    max-width: min(1600px, 100%);
    margin: 0 auto;
}

.page-container,
.main-content {
    padding: 0;
}

.content > h1,
.content > .toolbar,
.content > .alert,
.content > .card,
.content > .table-responsive,
.content > .table-card,
.content > .filter-card,
.content > .dashboard-tabs,
.content > .dashboard-header {
    width: 100%;
    max-width: min(1600px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h1 {
    margin: 0;
}

.page-header-actions,
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-card,
.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
}

.filter-card {
    padding: 16px;
    margin-bottom: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-card {
    padding: 12px;
}

.table-scroll,
.admin-list-container {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: auto;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.filter-card,
.table-card,
.card,
.table-responsive,
.admin-list-container {
    box-sizing: border-box;
}

.table-card .table,
.admin-list-container .table {
    margin-bottom: 0;
}

.table-card thead th,
.admin-list-container thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #fff;
}

.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.action-buttons .btn {
    min-width: 84px;
}

@media (min-width: 1400px) {
    .page-container,
    .main-content,
    .page-content,
    .content > h1,
    .content > .toolbar,
    .content > .alert,
    .content > .card,
    .content > .table-responsive,
    .content > .table-card,
    .content > .filter-card,
    .content > .dashboard-tabs,
    .content > .dashboard-header {
        max-width: 90vw;
    }
}

@media (max-width: 1200px) {
    .content {
        padding: 16px;
    }

    .page-container,
    .main-content,
    .page-content,
    .content > h1,
    .content > .toolbar,
    .content > .alert,
    .content > .card,
    .content > .table-responsive,
    .content > .table-card,
    .content > .filter-card,
    .content > .dashboard-tabs,
    .content > .dashboard-header {
        max-width: 100%;
    }
}

/* ====== Responsividade ====== */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        overflow-x: auto;
        white-space: nowrap;
        display: flex;
        padding: 0.5rem;
    }
    
    .sidebar-header {
        margin-bottom: 0;
        margin-right: 1rem;
    }
    
    .sidebar .nav-link {
        margin-right: 0.5rem;
        margin-bottom: 0;
    }
    
    .sidebar .nav-section {
        display: none;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-period {
        margin-top: 0.5rem;
    }

    .content {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-grid,
    .filters-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .table {
        min-width: 900px;
    }
    
    .row {
        flex-wrap: wrap;
    }
    
    .col-md-4, .col-md-6, .col-md-8, .col-md-12 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .tab-header {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
}

@media (max-width: 991.98px) {
    .table-scroll,
    .admin-list-container {
        max-height: 48vh;
    }
}

@media (max-width: 767.98px) {
    .table-scroll,
    .admin-list-container {
        max-height: 45vh;
    }
}

.dashboard-content {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

/* Ajustes adicionais para responsividade */
@media (max-width: 576px) {
    .chart-container {
        height: 200px;
    }
    
    .card-metric {
        padding: 0.75rem;
    }
    
    .card-metric .value {
        font-size: 18px;
    }
    
    .table th, .table td {
        padding: 0.5rem;
        font-size: 12px;
    }
}

/* ====== Dashboard ====== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-period {
    font-size: 14px;
    color: #6b7280;
}

.card-metric {
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    height: 100%;
}

.card-metric h3 {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

.card-metric .value {
    font-size: 22px;
    font-weight: bold;
    color: #111827;
    margin-bottom: 0.5rem;
}

.metric-footer {
    margin-top: auto;
    font-size: 13px;
}

.metric-footer a {
    color: #4C6EF5;
    text-decoration: none;
}

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    /* Altura automática para permitir expansão conforme o conteúdo */
    height: auto;
    border: none;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    background-color: transparent;
}

.card-header h3 {
    font-size: 16px;
    margin: 0;
    color: #374151;
}

.card-body {
    padding: 1rem 1.25rem;
}

/* ====== Compact inputs and scheduling layout ====== */
.compact-form .form-control,
.compact-form .form-select {
    padding: 0.375rem 0.5rem;
    font-size: 0.9rem;
}
.schedule-calendar {
    flex: 1 1 420px;
    min-width: 360px;
}
.schedule-times {
    flex: 0 0 280px;
    max-width: 300px;
}
.schedule-times .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
    line-height: 1.1;
}
.schedule-times .btn:disabled {
    color: #6b7280;
    border-color: #d1d5db;
    background-color: #f3f4f6;
    cursor: not-allowed;
}
@media (max-width: 768px) {
    .schedule-calendar, .schedule-times {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }
}

/* ====== Calendar highlight and cursor ====== */
.e-calendar {
    cursor: default;
}
.e-calendar .e-content td:not(.e-disabled) {
    cursor: pointer;
}
.e-calendar .e-content td > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    margin: 2px;
    border-radius: 50%;
}
.e-calendar .e-content td:not(.e-disabled) > span:hover {
    background-color: #eef2ff;
    border-radius: 50%;
}
.e-calendar .e-content td.e-selected > span {
    background-color: #4C6EF5;
    color: #fff;
}
.e-calendar .e-content td.e-today:not(.e-selected) > span {
    background-color: #e9ecef;
    color: inherit;
}
/* Dias desabilitados (não atendidos ou datas passadas) */
.e-calendar .e-content td.e-disabled > span {
    background-color: #f9fafb;
    color: #9ca3af;
    opacity: 0.65;
    border: 1px dashed #e5e7eb;
}

/* Botões do formulário visíveis e com espaçamento adequado */
.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.table th {
    font-weight: 600;
    color: #4b5563;
    font-size: 14px;
}

.status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.status.confirmed, .status.completed {
    background-color: #dcfce7;
    color: #166534;
}

.status.pending {
    background-color: #fef9c3;
    color: #854d0e;
}

.status.canceled {
    background-color: #fee2e2;
    color: #991b1b;
}

.dashboard-tabs {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1rem;
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-right: 1rem;
}

.tab.active {
    color: #4C6EF5;
    border-bottom-color: #4C6EF5;
}

.tab-spacer {
    flex: 1;
}

.tab-addon {
    display: flex;
    align-items: center;
    padding: 1rem;
    font-size: 14px;
    font-weight: 500;
    color: #4C6EF5;
    cursor: pointer;
}

.tab-content {
    padding: 1.5rem;
    display: none;
}

.tab-content.active {
    display: block;
}

.chart-container {
    width: 100%;
    height: 300px;
    margin-top: 1rem;
    position: relative;
}

#salesChart {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Responsividade */
@media (max-width: 991px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}
