/**
 * MoveCX IA 1.0 - Design System Ultra Refinado & Minimalista
 * Paleta: #335F4E (Dark), #9EEA6C (Light Accent), #1E2322 (Rich Black), #F8FAFA (Soft)
 * Padrão: Ícones vetoriais simples (14-16px), menu compacto, tipografia discreta
 */

:root {
    --move-dark: #335F4E;
    --move-dark-hover: #264b3c;
    --move-dark-rgb: 51, 95, 78;
    --move-light: #9EEA6C;
    --move-light-hover: #8fd85d;
    --move-black: #1E2322;
    --move-soft: #F8FAFA;
    
    --gray-50: #FAFCFC;
    --gray-100: #F1F4F4;
    --gray-200: #E4E8E8;
    --gray-300: #CBD3D3;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    
    --white: #FFFFFF;
    --border-color: #E2E7E7;
    --border-light: #EDF1F1;

    --danger: #E11D48;
    --danger-bg: #FFF1F2;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --success: #059669;
    --success-bg: #ECFDF5;
    --info: #2563EB;
    --info-bg: #EFF6FF;

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-sm: 0 1px 3px rgba(35, 60, 50, 0.04);
    --shadow-md: 0 3px 10px -1px rgba(35, 60, 50, 0.06);
    --shadow-lg: 0 8px 20px -3px rgba(35, 60, 50, 0.08);
    --shadow-modal: 0 16px 36px -6px rgba(20, 30, 25, 0.18);

    --sidebar-width: 216px;
    --header-height: 48px;
    --bottom-nav-height: 48px;

    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--move-soft);
    color: var(--move-black);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.84rem;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   SVG Icons Utility (Traço Fino e Minimalista)
   ========================================================================== */
.icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    stroke-width: 1.6;
    vertical-align: middle;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.icon-xs {
    width: 12px;
    height: 12px;
    stroke-width: 1.75;
}

.icon-sm {
    width: 13.5px;
    height: 13.5px;
    stroke-width: 1.75;
}

.icon-md {
    width: 16px;
    height: 16px;
    stroke-width: 1.6;
}

.icon-lg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    color: var(--move-dark);
    letter-spacing: -0.02em;
}

/* ==========================================================================
   Layout Shell (Compacto & Elegante)
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: #1F3C31; /* Move Dark elegante e sóbrio */
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition-smooth);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-logo {
    height: 22px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0.6rem 0.6rem 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
    transition: var(--transition-fast);
}

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

.nav-item.active {
    background: var(--move-light);
    color: #173327;
    font-weight: 800;
}

.nav-item.active .icon {
    stroke: #173327;
}

.sidebar-footer {
    padding: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.1);
}

.tenant-selector {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.55rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tenant-selector:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
}

.tenant-info {
    overflow: hidden;
}

.tenant-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--move-light);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.1rem;
}

.tenant-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition-smooth);
}

/* Header / Topbar */
.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--move-dark);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-xs);
}

.page-headline {
    display: flex;
    flex-direction: column;
}

.page-headline h1 {
    font-size: 1rem;
    line-height: 1.1;
    color: var(--move-dark);
    font-weight: 800;
}

.page-headline .breadcrumbs {
    font-size: 0.68rem;
    color: var(--gray-500);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.user-profile-menu:hover {
    background: var(--white);
    border-color: var(--border-color);
}

.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--move-dark);
    color: var(--move-light);
    font-weight: 800;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-meta-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--move-dark);
}

.user-role-badge {
    font-size: 0.58rem;
    font-weight: 800;
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-full);
    background: rgba(51, 95, 78, 0.08);
    color: var(--move-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Page Body Container */
.app-content {
    flex: 1;
    padding: 1.25rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Cards & Modern Containers
   ========================================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem;
    margin-bottom: 1rem;
    transition: var(--transition-smooth);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: #D6DEDE;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--move-dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* KPI Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.metric-card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-subtle);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(51, 95, 78, 0.2);
}

.metric-number {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--move-dark);
    line-height: 1.1;
}

.metric-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.metric-icon-box {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-box-primary { background: rgba(51, 95, 78, 0.06); color: var(--move-dark); }
.icon-box-success { background: var(--success-bg); color: var(--success); }
.icon-box-warning { background: var(--warning-bg); color: var(--warning); }
.icon-box-danger  { background: var(--danger-bg); color: var(--danger); }
.icon-box-info    { background: var(--info-bg); color: var(--info); }

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.42rem 0.8rem;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition-fast);
    user-select: none;
    line-height: 1.2;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    border-radius: var(--radius-xs);
}

.btn-lg {
    padding: 0.6rem 1.2rem;
    font-size: 0.86rem;
    border-radius: var(--radius-md);
}

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

.btn-primary:hover {
    background: var(--move-dark-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(51, 95, 78, 0.18);
}

.btn-accent {
    background: var(--move-light);
    color: #173327;
    font-weight: 800;
}

.btn-accent:hover {
    background: var(--move-light-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(158, 234, 108, 0.3);
}

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

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--move-dark);
    color: var(--move-dark);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #FECACA;
}

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

/* Forms */
.form-group {
    margin-bottom: 0.85rem;
}

.form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--move-dark);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    color: var(--move-black);
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    background: var(--white);
    border-color: var(--move-dark);
    box-shadow: 0 0 0 2px rgba(51, 95, 78, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

/* ==========================================================================
   Tables & Mobile Expandable Cards Pattern
   ========================================================================== */
.table-container {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.data-table th {
    background: var(--gray-50);
    padding: 0.65rem 0.85rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--move-dark);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem 0.85rem;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.data-table tr:hover td {
    background: #FAFDFD;
}

/* Mobile Expandable Cards */
.mobile-card-list {
    display: none;
    flex-direction: column;
    gap: 0.65rem;
}

.mobile-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    box-shadow: var(--shadow-subtle);
    transition: var(--transition-fast);
}

.mobile-card-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.55rem;
}

.mobile-card-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--move-dark);
}

.mobile-card-subtitle {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin-top: 0.05rem;
}

.mobile-card-details {
    display: none;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.76rem;
}

.mobile-card.expanded .mobile-card-details {
    display: block;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px dashed var(--border-light);
    font-size: 0.78rem;
}

.detail-label {
    font-weight: 600;
    color: var(--gray-500);
}

.detail-value {
    font-weight: 700;
    color: var(--move-black);
}

.mobile-card-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   Badges, Status & Empty States
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-active {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #A7F3D0;
}

.status-inactive {
    background: var(--gray-100);
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(51, 95, 78, 0.05);
    color: var(--move-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.empty-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--move-dark);
    margin-bottom: 0.25rem;
}

.empty-desc {
    font-size: 0.78rem;
    color: var(--gray-500);
    max-width: 380px;
    margin-bottom: 1rem;
}

/* Segmented Control / Tabs */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.5rem 0.85rem;
    font-family: 'Nunito', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-500);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--move-dark);
}

.tab-btn.active {
    color: var(--move-dark);
    border-bottom-color: var(--move-dark);
    font-weight: 800;
}

/* ==========================================================================
   Modals & Toasts
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 28, 25, 0.5);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-color);
    animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
    from { transform: scale(0.98); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-body {
    padding: 1.15rem;
}

.modal-footer {
    padding: 0.75rem 1.15rem;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toast {
    background: var(--move-black);
    color: var(--white);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    animation: toastIn 0.2s ease-out;
}

.toast-success { background: #064E3B; border-left: 3px solid var(--move-light); }
.toast-error   { background: #881337; border-left: 3px solid #FB7185; }
.toast-info    { background: #1E3A8A; border-left: 3px solid #60A5FA; }

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

/* ==========================================================================
   Mobile Navigation & Responsive Breakpoints
   ========================================================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--white);
    border-top: 1px solid var(--border-color);
    z-index: 95;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.2rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.03);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 0.64rem;
    font-weight: 700;
    gap: 0.1rem;
    flex: 1;
    padding: 0.25rem 0;
    transition: var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--move-dark);
    font-weight: 800;
}

.bottom-nav-item.active .icon {
    stroke: var(--move-dark);
}

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

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

    .app-main {
        margin-left: 0;
        padding-bottom: var(--bottom-nav-height);
    }

    .menu-toggle-btn {
        display: block;
    }

    .bottom-nav {
        display: flex;
    }

    /* Transform Tables into Cards on Mobile */
    .table-container {
        display: none;
    }

    .mobile-card-list {
        display: flex;
    }

    .app-content {
        padding: 0.85rem 0.75rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    .metric-number {
        font-size: 1.25rem;
    }

    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(var(--bottom-nav-height) + 0.65rem);
    }
}
