/**
 * dashboard.css - Dashboard Page Styles
 * BO Inteligente - SaaS Phase 2
 */

/* Dashboard Page Container */
header {
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title.roboto {
    font-family: "Roboto", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-variation-settings: "wdth" 100;
}

.header-title {
    color: rgb(191, 219, 254);
    font-size: 22px;
    padding-left: 10px;
}

/* Small Mobile (<480px) */
@media (max-width: 480px) {
    .header-title {
        display: none;
    }
}

.header-title-bo {
    font-weight: 600;
}

.header-title-inteligente {
    font-weight: 400;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-user-name {
    font-size: 14px;
    color: rgb(191, 219, 254);
    font-weight: 500;
}

/* Tablet (768px - 1023px) */
@media (max-width: 768px) {
    .dashboard-user-name {
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}


.dashboard-logout {
    /* Recommended size for mobile tap targets */
    min-height: 44px;
    padding: 0 16px;

    /* Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Space between icon and text */

    /* Styling */
    background: transparent;
    color: rgb(191, 219, 254);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    /* Slightly larger for mobile readability */
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hide the icon on desktop by default (optional, keep it if you like icons) */
.logout-icon {
    display: none;
    flex-shrink: 0;
}

.dashboard-logout:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.dashboard-logout:active {
    transform: scale(0.95);
    /* Slightly more pronounced feedback for touch */
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .dashboard-logout {
        padding: 0;
        /* Remove side padding */
        width: 44px;
        /* Make it a perfect square */
    }

    .logout-text {
        display: none;
        /* Hide the word "Sair" */
    }

    .logout-icon {
        display: block;
        /* Show the icon instead */
    }
}


/* ============================================
   DASHBOARD PAGE — Redesign (Concept A)
   ============================================ */

/* Page layout */
.dashboard-page {
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 55px);
    background: #f5f7f8;
    padding: 32px 16px;
}
.dashboard-container {
    width: 100%;
    max-width: 900px;
}

/* Page title bar */
.dashboard-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.dashboard-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.dashboard-version {
    font-size: 14px;
    font-weight: 400;
    color: #9ca3af;
    vertical-align: middle;
}
.dashboard-new-btn {
    background: #2563EB;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}
.dashboard-new-btn:hover {
    background: #1d4ed8;
}
.dashboard-new-btn:active {
    transform: scale(0.98);
}
.dashboard-new-btn__short {
    display: none;
}

/* Filter card */
.dashboard-filter-card {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 1px 2px -1px rgba(0, 0, 0, 0.06),
        0 2px 4px 0 rgba(0, 0, 0, 0.04);
    padding: 24px;
    margin-bottom: 24px;
}
.dashboard-filter-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Status chips */
.dashboard-chips {
    display: flex;
    gap: 8px;
}
.dashboard-chip {
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f1f5f9;
    color: #475569;
}
.dashboard-chip--active {
    background: #2563EB;
    color: white;
}
.dashboard-chip:hover:not(.dashboard-chip--active) {
    background: #e2e8f0;
}

/* Search */
.dashboard-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.dashboard-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
}
.dashboard-search {
    width: 100%;
    box-sizing: border-box;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 16px 8px 40px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
}
.dashboard-search:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Secondary filters row */
.dashboard-filter-divider {
    border-top: 1px solid #f1f5f9;
    margin-top: 16px;
    padding-top: 16px;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.dashboard-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dashboard-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dashboard-filter-select {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
}
.dashboard-filter-select:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.dashboard-clear-filters {
    color: #2563EB;
    font-size: 14px;
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    margin-left: auto;
}
.dashboard-clear-filters:hover {
    text-decoration: underline;
}

/* Result count */
.dashboard-result-count {
    font-size: 13px;
    color: #6b7280;
    padding: 8px 0;
}

/* BO Card list */
.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* BO Card (compact with left stripe) */
.dashboard-card {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 1px 2px -1px rgba(0, 0, 0, 0.06),
        0 2px 4px 0 rgba(0, 0, 0, 0.04);
    /* overflow:hidden removed — would clip the overflow menu */
    display: flex;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}
.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.dashboard-card:focus-within {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}
.dashboard-card__stripe {
    width: 6px;
    /* Raio esquerdo igual ao card pai para raio concêntrico correto */
    border-radius: var(--radius-card) 0 0 var(--radius-card);
    flex-shrink: 0;
}
.dashboard-card__stripe--draft {
    background: #f59e0b;
}
.dashboard-card__stripe--completed {
    background: #10b981;
}
.dashboard-card__content {
    flex: 1;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.dashboard-card__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.dashboard-card__id-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-card__id {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: -0.025em;
}
.dashboard-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}
.dashboard-badge--draft {
    background: #fef3c7;
    color: #b45309;
}
.dashboard-badge--completed {
    background: #dcfce7;
    color: #15803d;
}
.dashboard-card__type {
    font-weight: 700;
    color: #0f172a;
    font-size: 15px;
    text-wrap: balance;
}
.dashboard-card__type-emoji {
    font-size: 20px;
    margin-right: 6px;
}
.dashboard-card__meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}
.dashboard-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

/* Action buttons */
.dashboard-btn {
    padding: 8px 16px;
    border-radius: var(--radius-card-inner);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}
.dashboard-btn--primary {
    background: #2563EB;
    color: white;
}
.dashboard-btn--primary:hover {
    background: #1d4ed8;
}
.dashboard-btn--secondary {
    background: transparent;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.dashboard-btn--secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Overflow menu */
.dashboard-overflow-btn {
    padding: 8px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 20px;
    background: none;
    border: none;
    border-radius: 4px;
    line-height: 1;
}
.dashboard-overflow-btn:hover {
    background: #f1f5f9;
    color: #64748b;
}
.dashboard-overflow-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border-radius: var(--radius-card-inner);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 1px 2px -1px rgba(0, 0, 0, 0.06),
        0 2px 4px 0 rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 4px;
    z-index: 10;
    min-width: 140px;
}
.dashboard-overflow-menu__item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    border-radius: 4px;
    color: #ef4444;
    font-weight: 500;
}
.dashboard-overflow-menu__item:hover {
    background: #fef2f2;
}

/* Empty state */
.dashboard-empty {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 1px 2px -1px rgba(0, 0, 0, 0.06),
        0 2px 4px 0 rgba(0, 0, 0, 0.04);
    padding: 48px;
    text-align: center;
    max-width: 900px;
}
.dashboard-empty__icon {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(37,99,235,0.05);
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}
.dashboard-empty__title {
    font-size: 24px;
    font-weight: 700;
    color: #0d131c;
    margin: 0 0 12px;
}
.dashboard-empty__text {
    font-size: 16px;
    color: #64748b;
    max-width: 448px;
    margin: 0 auto;
    line-height: 1.6;
}
.dashboard-empty__cta {
    margin-top: 40px;
}

/* Filtered empty state */
.dashboard-empty--filtered {
    padding: 32px;
}
.dashboard-empty--filtered .dashboard-empty__icon {
    width: 80px;
    height: 80px;
    font-size: 32px;
    margin-bottom: 16px;
}
.dashboard-empty--filtered .dashboard-empty__title {
    font-size: 18px;
}

/* Skeleton loading */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.dashboard-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dashboard-skeleton__card {
    background: #fff;
    border-radius: var(--radius-card);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    height: 88px;
}
.dashboard-skeleton__stripe {
    width: 6px;
    background: #e2e8f0;
}
.dashboard-skeleton__content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dashboard-skeleton__line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.dashboard-skeleton__line--short {
    width: 40%;
}
.dashboard-skeleton__line--medium {
    width: 60%;
}
.dashboard-skeleton__line--long {
    width: 80%;
}

/* Error state */
.dashboard-error {
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}
.dashboard-error__icon {
    font-size: 32px;
    margin-bottom: 12px;
}
.dashboard-error__title {
    font-size: 16px;
    font-weight: 600;
    color: #dc2626;
    margin: 0 0 8px;
}
.dashboard-error__text {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 16px;
}
.dashboard-error__retry {
    padding: 8px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.dashboard-error__retry:hover {
    background: #dc2626;
}

/* Pagination */
.dashboard-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}
.dashboard-pagination__btn {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.dashboard-pagination__btn:hover:not(:disabled) {
    color: #2563EB;
}
.dashboard-pagination__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.dashboard-pagination__page {
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius-card-inner);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-family: inherit;
    transition: all 0.2s ease;
    /* Números de página com largura fixa — evitar salto de layout */
    font-variant-numeric: tabular-nums;
}
.dashboard-pagination__page:hover {
    border-color: #2563EB;
    color: #2563EB;
}
.dashboard-pagination__page--active {
    background: #2563EB;
    color: white;
    border-color: #2563EB;
    box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.dashboard-pagination__ellipsis {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Type Picker Modal */
.type-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.type-picker-overlay--visible {
    opacity: 1;
}
.type-picker-overlay--closing {
    opacity: 0;
}
.type-picker {
    background: #fff;
    border-radius: var(--radius-modal);
    padding: 32px;
    max-width: 640px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.type-picker-overlay--visible .type-picker {
    transform: translateY(0);
}
.type-picker__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}
.type-picker__title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    text-wrap: balance;
}
.type-picker__subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 4px 0 0;
}
.type-picker__close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
}
.type-picker__close:hover {
    background: #f1f5f9;
    color: #64748b;
}
.type-picker__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.type-picker__card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.type-picker__card:hover {
    border-color: #2563EB;
    background: #f8fafc;
}
.type-picker__card--selected {
    border-color: #2563EB;
    border-width: 2px;
    background: #eff6ff;
    padding: 19px;
}
.type-picker__card:focus {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}
.type-picker__card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}
.type-picker__card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(37,99,235,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.type-picker__card-name {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 4px;
}
.type-picker__card-desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}
.type-picker__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.type-picker__btn {
    padding: 12px 32px;
    border-radius: var(--radius-modal-inner);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.type-picker__btn--cancel {
    background: none;
    border: none;
    color: #64748b;
}
.type-picker__btn--cancel:hover {
    color: #374151;
}
.type-picker__btn--confirm {
    background: #2563EB;
    color: white;
    border: none;
}
.type-picker__btn--confirm:hover:not(:disabled) {
    background: #1d4ed8;
}
.type-picker__btn--confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Screen reader only */
.dashboard-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet and below */
@media (max-width: 767px) {
    .dashboard-page {
        padding: 16px;
    }
    .dashboard-title-bar {
        flex-wrap: wrap;
        gap: 12px;
    }
    .dashboard-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-search-wrapper {
        min-width: 0;
    }
    .dashboard-filter-divider {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-filter-group {
        width: 100%;
    }
    .dashboard-filter-select {
        width: 100%;
        box-sizing: border-box;
    }
    .dashboard-clear-filters {
        margin-left: 0;
        text-align: left;
    }
    .dashboard-card__content {
        flex-direction: column;
        align-items: flex-start;
    }
    .dashboard-card__actions {
        width: 100%;
    }
    /* Type picker becomes bottom sheet */
    .type-picker-overlay {
        align-items: flex-end;
    }
    .type-picker {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        padding: 24px;
    }
    .type-picker__grid {
        grid-template-columns: 1fr;
    }
    .type-picker__footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding-top: 16px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .dashboard-title {
        font-size: 20px;
    }
    .dashboard-new-btn__full {
        display: none;
    }
    .dashboard-new-btn__short {
        display: inline;
    }
    .dashboard-card {
        font-size: 13px;
    }
    .dashboard-card__meta {
        flex-direction: column;
        gap: 4px;
    }
    .dashboard-empty {
        padding: 32px 20px;
    }
    .dashboard-empty__icon {
        width: 120px;
        height: 120px;
        font-size: 48px;
    }
    .dashboard-empty__title {
        font-size: 20px;
    }
}