/*
    MFO.Tenants - Estilos Globais
    Tema farmaceutico: verde primario, azul clinico secundario
*/

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

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

/* Notificacoes dropdown */
.notification-menu .mud-menu-item {
    white-space: normal;
    min-width: 340px;
    padding: 10px 16px;
}

.notification-menu .mud-menu-item:hover {
    background: var(--mud-palette-action-default-hover);
}

.notification-item-unread {
    background: rgba(16, 185, 129, 0.04);
    border-left: 3px solid #10B981;
}

.notification-item-unread:hover {
    background: rgba(16, 185, 129, 0.08);
}

.mark-read-btn {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.mark-read-btn:hover {
    opacity: 1;
}

/* CSS Charts */
.chart-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: var(--chart-height, 200px);
    padding-top: 24px;
}

.chart-bar-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar-fill {
    width: 100%;
    max-width: 48px;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.chart-bar-value {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 4px;
}

.chart-bar-label {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin-top: 6px;
}

.doughnut-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.doughnut {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.doughnut-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--mud-palette-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

.chart-hbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-hbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-hbar-label {
    width: 120px;
    flex-shrink: 0;
}

.chart-hbar-track {
    flex: 1;
    height: 24px;
    background: var(--mud-palette-action-default-hover);
    border-radius: 6px;
    overflow: hidden;
}

.chart-hbar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.chart-hbar-fill span {
    font-size: 11px;
    color: white;
    font-weight: 600;
}

/* Utilitarios */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ============================================
   ANIMACOES
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 0.4; }
    100% { transform: scale(2.5); opacity: 0; }
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-fade-in {
    animation: fadeIn 0.35s ease-out both;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.3s ease-out both;
}

.animate-slide-in-right {
    animation: slideInRight 0.35s ease-out both;
}

.animate-slide-in-left {
    animation: slideInLeft 0.35s ease-out both;
}

.animate-pulse-soft {
    animation: pulse-soft 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Stagger delays para listas */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.30s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.40s; }

/* ============================================
   CARD EFFECTS
   ============================================ */

.hover-lift {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--mud-elevation-8);
}

/* Platform dashboard: 5 stat cards equal width, full row */
.dashboard-platform-stats.mud-grid {
    display: flex !important;
    flex-wrap: wrap;
    width: 100%;
}

.dashboard-platform-stats > .mud-grid-item.dashboard-stat-card-item {
    flex: 1 1 0 !important;
    flex-grow: 1 !important;
    flex-basis: 0 !important;
    min-width: 0;
    max-width: none !important;
    width: auto !important;
    display: flex;
}

.dashboard-stat-card {
    width: 100%;
    min-height: 5.5rem;
}

.dashboard-stat-card > .d-flex {
    height: 100%;
    width: 100%;
}

.dashboard-stat-avatar {
    flex-shrink: 0;
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.dashboard-stat-content {
    min-width: 0;
    flex: 1 1 auto;
    width: 100%;
}

.dashboard-stat-value {
    display: block;
    width: 100%;
    text-align: right;
    line-height: 1.2;
}

.tenant-stat-card .dashboard-stat-content {
    width: 100%;
}

@media (max-width: 599px) {
    .dashboard-platform-stats > .mud-grid-item.dashboard-stat-card-item {
        flex: 1 1 calc(50% - 0.75rem) !important;
        min-width: calc(50% - 0.75rem);
    }
}

@media (max-width: 399px) {
    .dashboard-platform-stats > .mud-grid-item.dashboard-stat-card-item {
        flex: 1 1 100% !important;
        min-width: 100%;
    }
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow:hover {
    box-shadow: 0 0 0 2px var(--mud-palette-primary-lighten);
}

/* ============================================
   FOCO ACESSIVEL
   ============================================ */

.mud-button:focus-visible,
.mud-icon-button:focus-visible,
.mud-nav-link:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* ============================================
   TABELA MODERNA
   ============================================ */

.mud-table-root .mud-table-head .mud-table-cell {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ============================================
   MAPA DE ENDEREÇO
   ============================================ */

.address-map-picker__canvas {
    height: 256px;
    overflow: hidden;
}

.address-map-picker__map {
    width: 100%;
    height: 100%;
    min-height: 256px;
}

.custom-pin-icon {
    background: transparent;
    border: none;
}

/* ============================================
   RESPONSIVIDADE MOBILE
   ============================================ */

/* Touch targets minimos 44x44px */
@media (pointer: coarse) {
    .mud-icon-button {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .mud-nav-link {
        min-height: 48px !important;
    }

    .mud-button {
        min-height: 44px !important;
    }

    .mud-input-control > .mud-input-control-input-container > .mud-input.mud-input-text {
        font-size: 16px !important; /* Previne zoom em iOS */
    }
}

/* Tablet e abaixo */
@media (max-width: 960px) {
    .tenants-main-content .mud-container {
        padding: 12px !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

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

    .mobile-hide {
        display: none !important;
    }
}

/* Telefone */
@media (max-width: 600px) {
    .app-title {
        font-size: 1rem !important;
    }

    .tenants-main-content .mud-container {
        padding: 8px !important;
    }

    .drawer-header {
        min-height: 56px;
        padding: 12px;
    }

    .drawer-header img {
        height: 32px !important;
    }
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */

.page-transition-enter {
    animation: fadeIn 0.3s ease-out;
}

.page-transition-enter-slow {
    animation: fadeIn 0.5s ease-out;
}

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

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

.status-dot-online {
    background-color: var(--mud-palette-success);
    box-shadow: 0 0 0 3px var(--mud-palette-success-lighten);
}

.status-dot-offline {
    background-color: var(--mud-palette-gray-default);
}

/* ============================================
   SCROLLBAR MUD-DATA-GRID / TABLE MOBILE
   ============================================ */

.mud-table-container {
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   TOAST / SNACKBAR CUSTOM
   ============================================ */

.mud-snackbar-content-message {
    font-weight: 500;
}
