/* ========================================
   CATALOG PAGES - Departamentos, Cargos, etc.
   ======================================== */

.catalog-page {
    padding: 2rem;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.catalog-header .rz-button {
    flex-shrink: 0;
}

.catalog-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ns-heading);
    margin: 0;
}

/* Card Grid */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* Individual Card */
.catalog-card {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--rz-base-200);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.catalog-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--rz-primary-lighter);
}

.catalog-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.catalog-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--rz-primary-lighter) 0%, var(--rz-primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.catalog-card-icon .rzi {
    font-size: 1.25rem;
    color: var(--rz-primary);
}

.catalog-card-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.catalog-card-subtitle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
}

.catalog-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ns-heading);
    margin: 0;
    flex: 1;
    /* Allow 2 lines before truncating */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    min-height: 1.3em;
}

.catalog-card-actions {
    display: flex;
    gap: 0.25rem;
}

.catalog-card-actions .rz-button {
    padding: 0.25rem;
    min-width: auto;
}

.catalog-card-actions .btn-danger-text {
    color: var(--rz-danger);
}

.catalog-card-actions .btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Card Stats */
.catalog-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--rz-base-200);
}

.catalog-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--rz-text-secondary-color);
}

.catalog-stat .rzi {
    font-size: 1.1rem;
    opacity: 0.7;
}

.catalog-stat .stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ns-heading);
}

.catalog-stat .stat-label {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
}

.catalog-stat.clickable {
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    margin: -0.35rem -0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    color: var(--rz-primary);
}

.catalog-stat.clickable .stat-value {
    color: var(--rz-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.catalog-stat.clickable:hover {
    background: var(--rz-primary-lighter);
}

.catalog-stat.clickable:hover .stat-value {
    text-decoration: none;
}

.catalog-stat .stat-link-icon {
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

/* Status Badge */
.catalog-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.catalog-badge .rzi {
    font-size: 0.85rem;
}

.catalog-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.catalog-badge.inactive {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Empty State */
.empty-state-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: white;
    border-radius: 12px;
    border: 2px dashed var(--rz-base-300);
}

.empty-state-large .empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--rz-base-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-state-large .empty-icon .rzi {
    font-size: 2.5rem;
    color: var(--rz-base-400);
}

.empty-state-large h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ns-heading);
    margin: 0 0 0.5rem 0;
}

.empty-state-large p {
    font-size: 0.95rem;
    color: var(--rz-text-secondary-color);
    margin: 0 0 1.5rem 0;
    max-width: 300px;
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-content {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--rz-base-200);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.2s ease-out;
}

.dialog-content.dialog-sm {
    max-width: 360px;
}

.dialog-content.dialog-md {
    max-width: 500px;
}

.dialog-content.dialog-lg {
    max-width: 640px;
}

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

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rz-base-200);
    flex-shrink: 0;
}

.dialog-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ns-heading);
    margin: 0;
}

.dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.dialog-body p {
    margin: 0;
    color: var(--rz-text-secondary-color);
    line-height: 1.5;
}

/* Form styles in dialogs */
.dialog-body .ns-form-group {
    margin-bottom: 1.25rem;
}

.dialog-body .ns-form-group:last-child {
    margin-bottom: 0;
}

.dialog-body .ns-form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ns-heading);
    margin-bottom: 0.5rem;
}

.dialog-body .help-text {
    display: block;
    font-size: 0.8rem;
    color: var(--rz-text-tertiary-color);
    margin-top: 0.35rem;
}

.dialog-body .rz-textbox,
.dialog-body .rz-dropdown {
    width: 100%;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    margin: 0;
    border-top: 1px solid var(--rz-base-200);
    background: var(--rz-base-50);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.dialog-footer .rz-button {
    min-width: 100px;
    flex-shrink: 0;
}

/* Employee List in Popup */
.employee-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.employee-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.employee-list-item:hover {
    background: var(--rz-base-100);
}

.employee-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rz-primary-lighter);
    color: var(--rz-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.employee-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.employee-name {
    font-weight: 500;
    color: var(--ns-heading);
}

.employee-position {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
}

.employee-list-item .rzi {
    color: var(--rz-base-400);
}

/* Loading State */
.catalog-page .loading-state {
    display: flex;
    justify-content: center;
    padding: 4rem;
}

/* ========================================
   CATALOG GRID TABLE (DataGrid style)
   ======================================== */

.catalog-grid-table {
    border: none;
}

.catalog-grid-table .rz-datatable-thead > tr > th {
    background: var(--rz-base-50);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rz-text-secondary-color);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--rz-base-200);
}

.catalog-grid-table .rz-datatable-tbody > tr > td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--rz-base-100);
    vertical-align: middle;
}

.catalog-grid-table .rz-datatable-tbody > tr:hover > td {
    background: var(--rz-base-50);
}

.catalog-grid-table .grid-name {
    font-weight: 500;
    color: var(--ns-heading);
}

.catalog-grid-table .grid-subtitle {
    font-size: 0.85rem;
    color: var(--rz-text-secondary-color);
}

.catalog-grid-table .text-muted {
    color: var(--rz-text-tertiary-color);
}

.catalog-grid-table .grid-actions {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

.catalog-grid-table .grid-actions .rz-button {
    padding: 0.25rem;
    min-width: auto;
}

.catalog-grid-table .btn-danger-text {
    color: var(--rz-danger);
}

.catalog-grid-table .btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Employee count link in grid */
.employee-count-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--rz-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.employee-count-link:hover {
    background: var(--rz-primary-lighter);
    text-decoration: none;
}

.employee-count-link .rzi {
    font-size: 1rem;
}

.employee-count-link span {
    font-weight: 600;
}

.employee-count-zero {
    color: var(--rz-text-tertiary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .catalog-page {
        padding: 1.25rem;
    }

    .catalog-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .catalog-header .rz-button {
        width: 100%;
        justify-content: center;
    }

    .catalog-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .catalog-card {
        padding: 1.25rem;
    }

    /* Dialog responsive */
    .dialog-overlay {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .dialog-content {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        animation: slideUpMobile 0.25s ease-out;
    }

    .dialog-content.dialog-sm,
    .dialog-content.dialog-md,
    .dialog-content.dialog-lg {
        max-width: 100%;
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .dialog-header {
        padding: 1rem;
    }

    .dialog-body {
        padding: 1rem;
    }

    .dialog-footer {
        padding: 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
        border-radius: 0;
        /* Safe area for mobile devices with notch */
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .dialog-footer .rz-button {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .catalog-page {
        padding: 1rem;
    }

    .catalog-title {
        font-size: 1.25rem;
    }

    .catalog-card-header {
        flex-wrap: wrap;
    }

    .catalog-card-title {
        flex: 1;
        min-width: 0;
    }

    .catalog-card-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--rz-base-100);
    }

    .empty-state-large {
        padding: 2rem 1rem;
    }

    .empty-state-large .empty-icon {
        width: 60px;
        height: 60px;
    }

    .empty-state-large .empty-icon .rzi {
        font-size: 2rem;
    }
}
